FSTMemoryPersistence.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 "Firestore/Source/Local/FSTLRUGarbageCollector.h"
  18. #import "Firestore/Source/Local/FSTLocalSerializer.h"
  19. #import "Firestore/Source/Local/FSTPersistence.h"
  20. #include "Firestore/core/src/firebase/firestore/model/document_key.h"
  21. #include "Firestore/core/src/firebase/firestore/model/types.h"
  22. NS_ASSUME_NONNULL_BEGIN
  23. /**
  24. * An in-memory implementation of the FSTPersistence protocol. Values are stored only in RAM and
  25. * are never persisted to any durable storage.
  26. */
  27. @interface FSTMemoryPersistence : NSObject <FSTPersistence>
  28. + (instancetype)persistenceWithEagerGC;
  29. + (instancetype)persistenceWithLruParams:(firebase::firestore::local::LruParams)lruParams
  30. serializer:(FSTLocalSerializer *)serializer;
  31. @end
  32. /**
  33. * Provides the eager GC implementation for memory persistence.
  34. */
  35. @interface FSTMemoryEagerReferenceDelegate : NSObject <FSTReferenceDelegate, FSTTransactional>
  36. - (instancetype)initWithPersistence:(FSTMemoryPersistence *)persistence;
  37. @end
  38. /**
  39. * Provides the LRU GC implementation for memory persistence.
  40. */
  41. @interface FSTMemoryLRUReferenceDelegate
  42. : NSObject <FSTReferenceDelegate, FSTLRUDelegate, FSTTransactional>
  43. - (instancetype)initWithPersistence:(FSTMemoryPersistence *)persistence
  44. serializer:(FSTLocalSerializer *)serializer
  45. lruParams:(firebase::firestore::local::LruParams)lruParams;
  46. - (BOOL)isPinnedAtSequenceNumber:(firebase::firestore::model::ListenSequenceNumber)upperBound
  47. document:(const firebase::firestore::model::DocumentKey &)key;
  48. @end
  49. NS_ASSUME_NONNULL_END