FCacheNode.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. @protocol FNode;
  18. @class FIndexedNode;
  19. @class FPath;
  20. /**
  21. * A cache node only stores complete children. Additionally it holds a flag
  22. * whether the node can be considered fully initialized in the sense that we
  23. * know at one point in time, this represented a valid state of the world, e.g.
  24. * initialized with data from the server, or a complete overwrite by the client.
  25. * It is not necessarily complete because it may have been from a tagged query.
  26. * The filtered flag also tracks whether a node potentially had children removed
  27. * due to a filter.
  28. */
  29. @interface FCacheNode : NSObject
  30. - (id)initWithIndexedNode:(FIndexedNode *)indexedNode
  31. isFullyInitialized:(BOOL)fullyInitialized
  32. isFiltered:(BOOL)filtered;
  33. - (BOOL)isCompleteForPath:(FPath *)path;
  34. - (BOOL)isCompleteForChild:(NSString *)childKey;
  35. @property(nonatomic, readonly) BOOL isFullyInitialized;
  36. @property(nonatomic, readonly) BOOL isFiltered;
  37. @property(nonatomic, strong, readonly) FIndexedNode *indexedNode;
  38. @property(nonatomic, strong, readonly) id<FNode> node;
  39. @end