Create application/directory for subdir, if metadata or permissions are applied.
[pithos-ios] / Classes / Container.h
1 //
2 //  Container.h
3 //  OpenStack
4 //
5 //  Created by Mike Mayo on 12/7/10.
6 //  The OpenStack project is provided under the Apache 2.0 license.
7 //
8
9 #import <Foundation/Foundation.h>
10
11 @class Folder;
12
13 @interface Container : NSObject <NSCoding>  {
14
15         // regular container attributes
16         NSString *name;
17         NSUInteger count;
18         unsigned long long bytes;
19     
20     // policy
21     NSString *versioning;
22     NSUInteger quota;
23     
24     // metadata
25     NSMutableDictionary *metadata;
26
27     // TODO: wade having trouble with directories without markers: user_files/12345/wade.jpg
28         
29         // CDN container attributes
30         BOOL cdnEnabled;
31         NSUInteger ttl;
32         NSString *cdnURL;
33         BOOL logRetention;
34         NSString *referrerACL;
35         NSString *useragentACL;
36     
37     // containers don't really have a folder structure, but we're going
38     // to simulate on by parsing object names
39     Folder *rootFolder;
40
41     // we have to use different API calls for CDN enabling for the first time
42     // vs CDN enabling later.  this flag will let us know which call to use
43     BOOL hasEverBeenCDNEnabled;
44 }
45
46 // regular container attributes
47 @property (nonatomic, retain) NSString *name;
48 @property (nonatomic, assign) NSUInteger count;
49 @property (nonatomic, assign) unsigned long long bytes;
50
51 //metadata
52 @property (nonatomic, retain) NSMutableDictionary *metadata;
53
54 //policy
55 @property (nonatomic, retain) NSString *versioning;
56 @property (nonatomic) NSUInteger quota;
57
58 -(NSString *)humanizedSize;
59 - (NSString *)osxStyleHumanizedSize;
60
61 // CDN container attributes
62 @property (nonatomic, assign) BOOL cdnEnabled;
63 @property (nonatomic, assign) NSUInteger ttl;
64 @property (nonatomic, retain) NSString *cdnURL;
65 @property (nonatomic, assign) BOOL logRetention;
66 @property (nonatomic, retain) NSString *referrerACL;
67 @property (nonatomic, retain) NSString *useragentACL;
68 @property (nonatomic, retain) Folder *rootFolder;
69 @property (nonatomic, retain) NSMutableDictionary *objectsBuffer;
70
71 @property (nonatomic, assign) BOOL hasEverBeenCDNEnabled;
72
73 + (Container *)fromJSON:(NSDictionary *)dict;
74 - (NSString *)humanizedBytes;
75 - (NSString *)osxStyleHumanizedBytes;
76 - (NSString *)humanizedCount;
77 - (NSString *)humanizedSize;
78
79 @end