Inheritance: IObjectStore
 public void TestSetUp()
 {
     storageSystem = new InMemoryStorageSystem();
     testStore = storageSystem.CreateStore("TestStore");
     objStore = new ObjectStore(1, testStore);
     objStore.Create();
 }
Exemple #2
0
 public LargeObject(ObjectStore store, long refId, long size, long currentSize, bool compressed, bool isComplete)
 {
     this.store = store;
     RawSize = size;
     CurrentSize = currentSize;
     Id = new ObjectId(store.Id, refId);
     IsCompressed = compressed;
     IsComplete = isComplete;
 }
        private void InitObjectStore()
        {
            // Does the file already exist?
            bool blobStoreExists = StoreSystem.StoreExists(ObjectStoreName);
            // If the blob store doesn't exist and we are read_only, we can't do
            // anything further so simply return.
            if (!blobStoreExists && IsReadOnly) {
                return;
            }

            // The blob store,
            if (blobStoreExists) {
                lobStore = StoreSystem.OpenStore(ObjectStoreName);
            } else {
                lobStore = StoreSystem.CreateStore(ObjectStoreName);
            }

            try {
                lobStore.Lock();

                // TODO: have multiple BLOB stores
                LargeObjectStore = new ObjectStore(0, lobStore);

                // Get the 64 byte fixed area
                var fixedArea = lobStore.GetArea(-1, false);
                // If the blob store didn't exist then we need to create it here,
                if (!blobStoreExists) {
                    long headerP = LargeObjectStore.Create();
                    fixedArea.WriteInt8(headerP);
                    fixedArea.Flush();
                } else {
                    // Otherwise we need to initialize the blob store
                    long headerP = fixedArea.ReadInt8();
                    LargeObjectStore.Open(headerP);
                }
            } finally {
                lobStore.Unlock();
            }
        }