Statistics
| Branch: | Tag: | Revision:

root / pithos-macos / PithosUtilities.h @ 9ab4b378

History | View | Annotate | Download (9.9 kB)

1
//
2
//  PithosUtilities.h
3
//  pithos-macos
4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
6
//
7
// Redistribution and use in source and binary forms, with or
8
// without modification, are permitted provided that the following
9
// conditions are met:
10
// 
11
//   1. Redistributions of source code must retain the above
12
//      copyright notice, this list of conditions and the following
13
//      disclaimer.
14
// 
15
//   2. Redistributions in binary form must reproduce the above
16
//      copyright notice, this list of conditions and the following
17
//      disclaimer in the documentation and/or other materials
18
//      provided with the distribution.
19
// 
20
// THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
21
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
24
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27
// USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28
// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
// POSSIBILITY OF SUCH DAMAGE.
32
// 
33
// The views and conclusions contained in the software and
34
// documentation are those of the authors and should not be
35
// interpreted as representing official policies, either expressed
36
// or implied, of GRNET S.A.
37

    
38
@class ASIPithosRequest;
39
@class ASIPithosContainerRequest;
40
@class ASIPithosObjectRequest;
41
@class ASIPithosObject;
42

    
43
@interface PithosUtilities : NSObject
44

    
45
+ (ASIPithosObjectRequest *)objectDataRequestWithContainerName:(NSString *)containerName 
46
                                                    objectName:(NSString *)objectName 
47
                                                   toDirectory:(NSString *)directoryPath 
48
                                                 checkIfExists:(BOOL)ifExists 
49
                                                sharingAccount:(NSString *)sharingAccount;
50
+ (NSArray *)objectDataRequestsForSubdirWithContainerName:(NSString *)containerName 
51
                                               objectName:(NSString *)objectName 
52
                                              toDirectory:(NSString *)directoryPath 
53
                                            checkIfExists:(BOOL)ifExists 
54
                                           sharingAccount:(NSString *)sharingAccount;
55

    
56

    
57
+ (ASIPithosObjectRequest *)objectBlockDataRequestWithContainerName:(NSString *)containerName 
58
                                                             object:(ASIPithosObject *)object 
59
                                                         blockIndex:(NSUInteger)blockIndex 
60
                                                          blockSize:(NSUInteger)blockSize;
61
+ (NSIndexSet *)missingBlocksForFile:(NSString *)filePath
62
                           blockSize:(NSUInteger)blockSize 
63
                           blockHash:(NSString *)blockHash 
64
                          withHashes:(NSArray *)hashes;
65

    
66
+ (ASIPithosObjectRequest *)writeObjectDataRequestWithContainerName:(NSString *)containerName
67
                                                         objectName:(NSString *)objectName
68
                                                        contentType:(NSString *)contentType 
69
                                                          blockSize:(NSUInteger)blockSize 
70
                                                          blockHash:(NSString *)blockHash 
71
                                                            forFile:(NSString *)filePath 
72
                                                      checkIfExists:(BOOL)ifExists 
73
                                                             hashes:(NSArray **)hashes 
74
                                                     sharingAccount:(NSString *)sharingAccount;
75
+ (NSIndexSet *)missingBlocksForHashes:(NSArray *)hashes withMissingHashesResponse:(NSString *)missingHashesResponse;
76
+ (ASIPithosContainerRequest *)updateContainerDataRequestWithContainerName:(NSString *)containerName 
77
                                                                 blockSize:(NSUInteger)blockSize 
78
                                                                   forFile:(NSString *)filePath 
79
                                                                    hashes:(NSArray *)hashes 
80
                                                     missingHashesResponse:(NSString *)missingHashesResponse 
81
                                                            sharingAccount:(NSString *)sharingAccount;
82
+ (ASIPithosContainerRequest *)updateContainerDataRequestWithContainerName:(NSString *)containerName 
83
                                                                 blockSize:(NSUInteger)blockSize 
84
                                                                   forFile:(NSString *)filePath 
85
                                                         missingBlockIndex:(NSUInteger)missingBlockIndex 
86
                                                            sharingAccount:(NSString *)sharingAccount;
87
+ (NSArray *)writeObjectDataRequestsWithContainerName:(NSString *)containerName
88
                                           objectName:(NSString *)objectName
89
                                            blockSize:(NSUInteger)blockSize 
90
                                            blockHash:(NSString *)blockHash 
91
                                         forDirectory:(NSString *)directoryPath 
92
                                        checkIfExists:(BOOL)ifExists 
93
                                          objectNames:(NSMutableArray **)objectNames
94
                                         contentTypes:(NSMutableArray **)contentTypes
95
                                            filePaths:(NSMutableArray **)filePaths 
96
                                         hashesArrays:(NSMutableArray **)hashesArrays 
97
                              directoryObjectRequests:(NSMutableArray **) directoryObjectRequests 
98
                                       sharingAccount:(NSString *)sharingAccount;
99

    
100
+ (NSArray *)deleteObjectRequestsForSubdirWithContainerName:(NSString *)containerName objectName:(NSString *)objectName;
101

    
102
+ (ASIPithosObjectRequest *)copyObjectRequestWithContainerName:(NSString *)containerName 
103
                                                    objectName:(NSString *)objectName 
104
                                      destinationContainerName:(NSString *)destinationContainerName 
105
                                         destinationObjectName:(NSString *)destinationObjectName 
106
                                                 checkIfExists:(BOOL)ifExists 
107
                                                sharingAccount:(NSString *)sharingAccount;
108
+ (NSArray *)copyObjectRequestsForSubdirWithContainerName:(NSString *)containerName 
109
                                               objectName:(NSString *)objectName 
110
                                 destinationContainerName:(NSString *)destinationContainerName 
111
                                    destinationObjectName:(NSString *)destinationObjectName 
112
                                            checkIfExists:(BOOL)ifExists 
113
                                           sharingAccount:(NSString *)sharingAccount;
114

    
115

    
116
+ (ASIPithosObjectRequest *)moveObjectRequestWithContainerName:(NSString *)containerName 
117
                                                    objectName:(NSString *)objectName 
118
                                      destinationContainerName:(NSString *)destinationContainerName 
119
                                         destinationObjectName:(NSString *)destinationObjectName 
120
                                                 checkIfExists:(BOOL)ifExists;
121
+ (NSArray *)moveObjectRequestsForSubdirWithContainerName:(NSString *)containerName 
122
                                               objectName:(NSString *)objectName 
123
                                 destinationContainerName:(NSString *)destinationContainerName 
124
                                    destinationObjectName:(NSString *)destinationObjectName 
125
                                            checkIfExists:(BOOL)ifExists;
126

    
127
+ (NSUInteger)bytesOfFile:(NSString *)filePath;
128
+ (NSString *)contentTypeOfFile:(NSString *)filePath error:(NSError **)error;
129
+ (BOOL)isContentTypeDirectory:(NSString *)contentType;
130
+ (BOOL)objectExistsAtContainerName:(NSString *)containerName objectName:(NSString *)objectName
131
                              error:(NSError **)error isDirectory:(BOOL *)isDirectory sharingAccount:(NSString *)sharingAccount;
132
+ (BOOL)proceedIfObjectExistsAtContainerName:(NSString *)containerName objectName:(NSString *)objectName 
133
                              sharingAccount:(NSString *)sharingAccount;
134
+ (NSArray *)objectsWithContainerName:(NSString *)containerName objectNamePrefix:(NSString *)objectNamePrefix
135
                            delimiter:(NSString *)delimiter sharingAccount:(NSString *)sharingAccount;
136
+ (NSArray *)objectsForSubdirWithContainerName:(NSString *)containerName objectName:(NSString *)objectName
137
                                     delimiter:(NSString *)delimiter sharingAccount:(NSString *)sharingAccount;
138
+ (NSString *)safeObjectNameForContainerName:(NSString *)containerName objectName:(NSString *)objectName;
139
+ (NSString *)safeSubdirNameForContainerName:(NSString *)containerName subdirName:(NSString *)subdirName;
140

    
141
+ (NSInteger)httpRequestErrorAlertWithRequest:(ASIPithosRequest *)request;
142
+ (NSInteger)unexpectedResponseStatusAlertWithRequest:(ASIPithosRequest *)request;
143
+ (NSInteger)fileActionFailedAlertWithTitle:(NSString *)title message:(NSString *)message error:(NSError *)error;
144

    
145
+ (ASIPithosRequest *)prepareRequest:(ASIPithosRequest *)request priority:(NSOperationQueuePriority)priority;
146
+ (ASIPithosRequest *)prepareRequest:(ASIPithosRequest *)request;
147
+ (ASIPithosRequest *)copyRequest:(ASIPithosRequest *)request;
148

    
149
@end