FPersistenceManager.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "FNode.h"
  18. #import "FCompoundWrite.h"
  19. #import "FQuerySpec.h"
  20. #import "FRepoInfo.h"
  21. #import "FStorageEngine.h"
  22. #import "FCachePolicy.h"
  23. #import "FCacheNode.h"
  24. @interface FPersistenceManager : NSObject
  25. - (id)initWithStorageEngine:(id<FStorageEngine>)storageEngine cachePolicy:(id<FCachePolicy>)cachePolicy;
  26. - (void)close;
  27. - (void)saveUserOverwrite:(id<FNode>)node atPath:(FPath *)path writeId:(NSUInteger)writeId;
  28. - (void)saveUserMerge:(FCompoundWrite *)merge atPath:(FPath *)path writeId:(NSUInteger)writeId;
  29. - (void)removeUserWrite:(NSUInteger)writeId;
  30. - (void)removeAllUserWrites;
  31. - (NSArray *)userWrites;
  32. - (FCacheNode *)serverCacheForQuery:(FQuerySpec *)spec;
  33. - (void)updateServerCacheWithNode:(id<FNode>)node forQuery:(FQuerySpec *)spec;
  34. - (void)updateServerCacheWithMerge:(FCompoundWrite *)merge atPath:(FPath *)path;
  35. - (void)applyUserWrite:(id<FNode>)write toServerCacheAtPath:(FPath *)path;
  36. - (void)applyUserMerge:(FCompoundWrite *)merge toServerCacheAtPath:(FPath *)path;
  37. - (void)setQueryComplete:(FQuerySpec *)spec;
  38. - (void)setQueryActive:(FQuerySpec *)spec;
  39. - (void)setQueryInactive:(FQuerySpec *)spec;
  40. - (void)setTrackedQueryKeys:(NSSet *)keys forQuery:(FQuerySpec *)query;
  41. - (void)updateTrackedQueryKeysWithAddedKeys:(NSSet *)added removedKeys:(NSSet *)removed forQuery:(FQuerySpec *)query;
  42. @end