forked from arqbackup/arq_restore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReflogEntry.m
55 lines (50 loc) · 1.85 KB
/
ReflogEntry.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// ReflogEntry.m
// arq_restore
//
// Created by Stefan Reitshamer on 11/20/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "ReflogEntry.h"
#import "BlobKey.h"
#import "DictNode.h"
#import "SetNSError.h"
@implementation ReflogEntry
- (id)initWithData:(NSData *)theData error:(NSError **)error {
if (self = [super init]) {
DictNode *dictNode = [DictNode dictNodeWithXMLData:theData error:error];
if (dictNode == nil) {
[self release];
return nil;
}
if (![dictNode containsKey:@"oldHeadSHA1"]
|| ![dictNode containsKey:@"oldHeadStretchKey"]
|| ![dictNode containsKey:@"newHeadSHA1"]
|| ![dictNode containsKey:@"newHeadStretchKey"]) {
SETNSERROR(@"ReflogEntryErrorDomain", -1, @"missing values in reflog entry");
[self release];
return nil;
}
oldHeadBlobKey = [[BlobKey alloc] initWithSHA1:[[dictNode stringNodeForKey:@"oldHeadSHA1"] stringValue]
storageType:StorageTypeS3
stretchEncryptionKey:[[dictNode booleanNodeForKey:@"oldHeadStretchKey"] booleanValue]
compressed:NO];
newHeadBlobKey = [[BlobKey alloc] initWithSHA1:[[dictNode stringNodeForKey:@"newHeadSHA1"] stringValue]
storageType:StorageTypeS3
stretchEncryptionKey:[[dictNode booleanNodeForKey:@"newHeadStretchKey"] booleanValue]
compressed:NO];
}
return self;
}
- (void)dealloc {
[oldHeadBlobKey release];
[newHeadBlobKey release];
[super dealloc];
}
- (BlobKey *)oldHeadBlobKey {
return oldHeadBlobKey;
}
- (BlobKey *)newHeadBlobKey {
return newHeadBlobKey;
}
@end