예제 #1
0
        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,
            // TODO: Support store-level configuration?
            if (blobStoreExists)
            {
                lobStore = StoreSystem.OpenStore(ObjectStoreName, new Configuration());
            }
            else
            {
                lobStore = StoreSystem.CreateStore(ObjectStoreName, new Configuration());
            }

            try {
                lobStore.Lock();

                // TODO: have multiple BLOB stores
                LargeObjectStore = new LargeObjectStore(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.Write(headerP);
                    fixedArea.Flush();
                }
                else
                {
                    // Otherwise we need to initialize the blob store
                    long headerP = fixedArea.ReadInt64();
                    LargeObjectStore.Open(headerP);
                }
            } finally {
                lobStore.Unlock();
            }
        }
예제 #2
0
        private void CreateTable()
        {
            // Initially set the table sequence_id to 1
            sequenceId = 1;

            // Create and open the store.
            // TODO: have a table-level configuration?
            Store = StoreSystem.CreateStore(StoreName, new Configuration());

            try {
                Store.Lock();

                // Setup the list structure
                recordList = new FixedRecordList(Store, 12);
            } finally {
                Store.Unlock();
            }

            // Initialize the store to an empty state,
            SetupInitialStore();
            indexSetStore.PrepareIndexes(TableInfo.Columns.Count + 1, 1, 1024);
        }
예제 #3
0
        private void MinimalCreate(IEnumerable <ISystemFeature> features)
        {
            if (Exists())
            {
                throw new IOException("Composite already exists");
            }

            // Lock the store system (generates an IOException if exclusive Lock
            // can not be made).
            if (!IsReadOnly)
            {
                StoreSystem.Lock(StateStoreName);
            }

            // Create/Open the state store
            // TODO: Support store-level configuration?
            stateStore = StoreSystem.CreateStore(StateStoreName, new Configuration());
            try {
                stateStore.Lock();

                StateStore = new TableStateStore(stateStore);
                long headP = StateStore.Create();
                // Get the fixed area
                var fixedArea = stateStore.GetArea(-1);
                fixedArea.Write(headP);
                fixedArea.Flush();
            } finally {
                stateStore.Unlock();
            }

            Setup();

            // Init the conglomerate blob store
            InitObjectStore();

            // Create the system table (but don't initialize)
            CreateSystem(features);
        }
예제 #4
0
        internal void MinimalCreate()
        {
            if (Exists())
            {
                throw new IOException("Composite already exists");
            }

            // Lock the store system (generates an IOException if exclusive Lock
            // can not be made).
            if (!IsReadOnly)
            {
                StoreSystem.Lock(StateStoreName);
            }

            // Create/Open the state store
            stateStore = StoreSystem.CreateStore(StateStoreName);
            try {
                stateStore.Lock();

                StateStore = new TableStateStore(stateStore);
                long headP = StateStore.Create();
                // Get the fixed area
                var fixedArea = stateStore.GetArea(-1);
                fixedArea.WriteInt8(headP);
                fixedArea.Flush();
            } finally {
                stateStore.Unlock();
            }

            Setup();

            // Init the conglomerate blob store
            InitObjectStore();

            // Create the system table (but don't initialize)
            CreateSystemSchema();
        }