Deveel.Data.TableStateStore.Open C# (CSharp) Method

Open() public method

public Open ( long offset ) : void
offset long
return void
        public void Open(long offset)
        {
            lock (this) {
                headerArea = Store.GetArea(offset);
                int magicValue = headerArea.ReadInt4();
                if (magicValue != Magic)
                    throw new IOException("Magic value for state header area is incorrect.");

                if (headerArea.ReadInt4() != 0)
                    throw new IOException("Unknown version for state header area.");

                currentTableId = (int)headerArea.ReadInt8();
                visAreaPointer = headerArea.ReadInt8();
                delAreaPointer = headerArea.ReadInt8();

                // Setup the visible and delete list
                visibleList = new List<TableState>();
                deleteList = new List<TableState>();

                // Read the resource list for the visible and delete list.
                ReadStateResourceList(visibleList, visAreaPointer);
                ReadStateResourceList(deleteList, delAreaPointer);
            }
        }

Usage Example

        public void Open()
        {
            if (!Exists())
            {
                throw new IOException("Table composite does not exist");
            }

            // Check the file Lock
            if (!IsReadOnly)
            {
                // Obtain the Lock (generate error if this is not possible)
                StoreSystem.Lock(StateStoreName);
            }

            // Open the state store
            stateStore = StoreSystem.OpenStore(StateStoreName);
            StateStore = new TableStateStore(stateStore);

            // Get the fixed 64 byte area.
            var  fixedArea = stateStore.GetArea(-1);
            long headP     = fixedArea.ReadInt8();

            StateStore.Open(headP);

            Setup();

            InitObjectStore();

            ReadVisibleTables();
            ReadDroppedTables();

            CleanUp();
        }
All Usage Examples Of Deveel.Data.TableStateStore::Open