FCacheNode.h 1.6 KB

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