Files
firebase-ios-sdk/FirebaseDatabase/Sources/Core/FRepo.h
T

102 lines
3.9 KiB
Objective-C
Raw Normal View History

2017-05-15 12:27:07 -07:00
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2020-06-22 07:58:52 -07:00
#import "FirebaseDatabase/Sources/Core/FPersistentConnection.h"
#import "FirebaseDatabase/Sources/Core/FRepoInfo.h"
2020-07-31 07:22:02 -07:00
#import "FirebaseDatabase/Sources/Public/FirebaseDatabase/FIRDataEventType.h"
2021-01-07 17:41:32 -08:00
#import "FirebaseDatabase/Sources/Public/FirebaseDatabase/FIRDatabaseQuery.h"
2020-06-22 07:58:52 -07:00
#import "FirebaseDatabase/Sources/Utilities/Tuples/FTupleUserCallback.h"
2019-08-05 13:27:47 -07:00
#import <Foundation/Foundation.h>
2017-05-15 12:27:07 -07:00
@class FQuerySpec;
@class FPersistence;
@class FAuthenticationManager;
@class FIRDatabaseConfig;
@protocol FEventRegistration;
@class FCompoundWrite;
@protocol FClock;
@class FIRDatabase;
@interface FRepo : NSObject <FPersistentConnectionDelegate>
2021-01-07 17:41:32 -08:00
@property(nonatomic, strong) FIRDatabaseConfig *_Nullable config;
2017-05-15 12:27:07 -07:00
2021-01-07 17:41:32 -08:00
- (id _Nonnull)initWithRepoInfo:(FRepoInfo *_Nullable)info
config:(FIRDatabaseConfig *_Nullable)config
database:(FIRDatabase *_Nullable)database;
2017-05-15 12:27:07 -07:00
2021-01-07 17:41:32 -08:00
- (void)set:(FPath *_Nullable)path
withNode:(id _Nullable)node
withCallback:(fbt_void_nserror_ref _Nullable)onComplete;
- (void)update:(FPath *_Nullable)path
withNodes:(FCompoundWrite *_Nullable)compoundWrite
withCallback:(fbt_void_nserror_ref _Nullable)callback;
2019-08-05 13:27:47 -07:00
- (void)purgeOutstandingWrites;
2017-05-15 12:27:07 -07:00
2021-01-07 17:41:32 -08:00
- (void)getData:(FIRDatabaseQuery *_Nullable)query
withCompletionBlock:
(void (^_Nonnull)(NSError *_Nullable error,
FIRDataSnapshot *_Nullable snapshot))block;
2017-06-30 10:47:37 -07:00
2021-01-07 17:41:32 -08:00
- (void)addEventRegistration:(id<FEventRegistration> _Nullable)eventRegistration
forQuery:(FQuerySpec *_Nullable)query;
- (void)removeEventRegistration:
(id<FEventRegistration> _Nullable)eventRegistration
forQuery:(FQuerySpec *_Nullable)query;
- (void)keepQuery:(FQuerySpec *_Nullable)query synced:(BOOL)synced;
- (NSString *_Nullable)name;
2017-05-15 12:27:07 -07:00
- (NSTimeInterval)serverTime;
2021-01-07 17:41:32 -08:00
- (void)onDataUpdate:(FPersistentConnection *_Nullable)fpconnection
forPath:(NSString *_Nullable)pathString
message:(id _Nullable)message
2019-08-05 13:27:47 -07:00
isMerge:(BOOL)isMerge
2021-01-07 17:41:32 -08:00
tagId:(NSNumber *_Nullable)tagId;
- (void)onConnect:(FPersistentConnection *_Nullable)fpconnection;
- (void)onDisconnect:(FPersistentConnection *_Nullable)fpconnection;
2017-05-15 12:27:07 -07:00
// Disconnect methods
2021-01-07 17:41:32 -08:00
- (void)onDisconnectCancel:(FPath *_Nullable)path
withCallback:(fbt_void_nserror_ref _Nullable)callback;
- (void)onDisconnectSet:(FPath *_Nullable)path
withNode:(id<FNode> _Nullable)node
withCallback:(fbt_void_nserror_ref _Nullable)callback;
- (void)onDisconnectUpdate:(FPath *_Nullable)path
withNodes:(FCompoundWrite *_Nullable)compoundWrite
withCallback:(fbt_void_nserror_ref _Nullable)callback;
2017-05-15 12:27:07 -07:00
// Connection Management.
2019-08-05 13:27:47 -07:00
- (void)interrupt;
- (void)resume;
2017-05-15 12:27:07 -07:00
// Transactions
2021-01-07 17:41:32 -08:00
- (void)startTransactionOnPath:(FPath *_Nullable)path
update:
(fbt_transactionresult_mutabledata _Nullable)update
onComplete:
(fbt_void_nserror_bool_datasnapshot _Nullable)onComplete
2019-08-05 13:27:47 -07:00
withLocalEvents:(BOOL)applyLocally;
2017-05-15 12:27:07 -07:00
// Testing methods
2021-01-07 17:41:32 -08:00
- (NSDictionary *_Nullable)dumpListens;
2019-08-05 13:27:47 -07:00
- (void)dispose;
- (void)setHijackHash:(BOOL)hijack;
2017-05-15 12:27:07 -07:00
2021-01-07 17:41:32 -08:00
@property(nonatomic, strong, readonly) FAuthenticationManager *_Nullable auth;
@property(nonatomic, strong, readonly) FIRDatabase *_Nullable database;
2017-05-15 12:27:07 -07:00
@end