FWFS/ObjectStore.h
Go to the documentation of this file.
1 
22 #pragma once
23 
24 #include "../ObjectStore.h"
25 
26 #ifdef FWFS_OBJECT_CACHE
27 #include "ObjRefCache.h"
28 #endif
29 
30 namespace IFS
31 {
32 namespace FWFS
33 {
37 class ObjectStore : public IObjectStore
38 {
39 public:
40  ObjectStore(Storage::Partition partition) : partition(partition)
41  {
42  }
43 
44  int initialise() override;
45  int mounted(const FWObjDesc& od) override;
46 
47  bool isMounted() override
48  {
49  return flags[Flag::mounted];
50  }
51 
52  int open(FWObjDesc& od) override;
53  int openChild(const FWObjDesc& parent, const FWObjDesc& child, FWObjDesc& od) override;
54  int readHeader(FWObjDesc& od) override;
55  int readChildHeader(const FWObjDesc& parent, FWObjDesc& child) override;
56  int readContent(const FWObjDesc& od, uint32_t offset, uint32_t size, void* buffer) override;
57  int close(FWObjDesc& od) override;
58 
60  {
61  return partition;
62  }
63 
64 private:
65  enum class Flag {
66  mounted,
67  };
68 
69  Storage::Partition partition;
70  ObjRef lastFound;
71 #ifdef FWFS_OBJECT_CACHE
72  ObjRefCache cache;
73 #endif
75 };
76 
77 } // namespace FWFS
78 } // namespace IFS
int mounted(const FWObjDesc &od) override
called by FWFS to confirm successful mount
int readContent(const FWObjDesc &od, uint32_t offset, uint32_t size, void *buffer) override
read object content
Definition: ObjectStore.h:108
int readHeader(FWObjDesc &od) override
read a root object header
int open(FWObjDesc &od) override
find an object and return a descriptor for it
int close(FWObjDesc &od) override
close an object descriptor
ObjectStore(Storage::Partition partition)
Definition: FWFS/ObjectStore.h:40
Definition: DirectoryTemplate.h:36
int readChildHeader(const FWObjDesc &parent, FWObjDesc &child) override
fetch child object header
int initialise() override
called by FWFS
FWFS Object Descriptor.
Definition: ObjectStore.h:69
bool isMounted() override
determine if store is mounted
Definition: FWFS/ObjectStore.h:47
gives the identity and location of an FWFS object
Definition: ObjectStore.h:32
Represents a flash partition.
Definition: Partition.h:77
object store for read-only filesystem
Definition: FWFS/ObjectStore.h:37
Storage::Partition & getPartition() override
Definition: FWFS/ObjectStore.h:59
Cache the locations of several objects to improve search speed.
Definition: ObjRefCache.h:40
int openChild(const FWObjDesc &parent, const FWObjDesc &child, FWObjDesc &od) override
open a descriptor for a child object