Create() public method

public Create ( ) : long
return long
Exemplo n.º 1
0
 public void TestSetUp()
 {
     storageSystem = new InMemoryStorageSystem();
     testStore = storageSystem.CreateStore("TestStore");
     objStore = new ObjectStore(1, testStore);
     objStore.Create();
 }
        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();
            }
        }