-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathGTObjectDatabase.h
More file actions
74 lines (60 loc) · 2.67 KB
/
GTObjectDatabase.h
File metadata and controls
74 lines (60 loc) · 2.67 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// GTObjectDatabase.h
// ObjectiveGitFramework
//
// Created by Dave DeLong on 5/17/2011.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import "GTObject.h"
@class GTOID;
NS_ASSUME_NONNULL_BEGIN
@interface GTObjectDatabase : NSObject
@property (nonatomic, readonly, strong) GTRepository *repository;
- (instancetype)init NS_UNAVAILABLE;
/// Initializes the object database with the given repository. Designated initializer.
///
/// repo - The repository from which the object database should be created.
/// Cannot be nil.
/// error - The error if one occurred.
///
/// Returns the initialized object.
- (nullable instancetype)initWithRepository:(GTRepository *)repo error:(NSError **)error NS_DESIGNATED_INITIALIZER;
/// The underlying `git_odb` object.
- (git_odb *)git_odb __attribute__((objc_returns_inner_pointer));
- (nullable GTOdbObject *)objectWithOID:(GTOID *)OID error:(NSError **)error;
- (nullable GTOdbObject *)objectWithSHA:(NSString *)SHA error:(NSError **)error;
/// Writes the data into the object database.
///
/// data - The data to write. Cannot be nil.
/// type - The type of object to create with the data.
/// error - The error if one occurred.
///
/// Returns the OID for the object which was written, or nil if an error
/// occurred.
- (nullable GTOID *)writeData:(NSData *)data type:(GTObjectType)type error:(NSError **)error;
- (BOOL)containsObjectWithSHA:(NSString *)SHA error:(NSError **)error;
/// Checks if the object database contains an object with a given OID.
///
/// oid - Object ID to check
///
/// Returns YES if the object exists or NO otherwise.
- (BOOL)containsObjectWithOID:(GTOID *)oid;
@end
NS_ASSUME_NONNULL_END