private IStoreSystem DiscoverStoreSystem() { if (storeSystem == null) { var typeString = this.StoreSystemTypeName(); if (String.IsNullOrEmpty(typeString)) { storeSystem = Scope.Resolve <IStoreSystem>(); } else { var type = Type.GetType(typeString, false); if (type == null || !typeof(IStoreSystem).IsAssignableFrom(type)) { throw new InvalidOperationException($"Type '{typeString}' is not valid for a store system"); } storeSystem = Scope.Resolve(type) as IStoreSystem; Scope.AsContainer().RegisterInstance <IStoreSystem>(storeSystem); } } return(storeSystem); }
//public ITransaction CreateTransaction(TransactionIsolation isolation) { // var thisCommittedTables = new List<TableSource>(); // // Don't let a commit happen while we are looking at this. // lock (commitLock) { // long thisCommitId = CurrentCommitId; // var committedTableList = StateStore.GetVisibleList(); // thisCommittedTables.AddRange(committedTableList.Select(resource => GetTableSource(resource.TableId))); // // Create a set of IIndexSet for all the tables in this transaction. // var indexInfo = (thisCommittedTables.Select(mtable => mtable.CreateIndexSet())).ToList(); // // Create the transaction and record it in the open transactions list. // var t = new Transaction(this, thisCommitId, isolation, thisCommittedTables, indexInfo); // openTransactions.AddTransaction(t); // return t; // } //} private void Dispose(bool disposing) { if (disposing) { if (!IsClosed) { Close(); } if (lobStore != null) { lobStore.Dispose(); } if (stateStore != null) { stateStore.Dispose(); } if (tempStoreSystem != null) { tempStoreSystem.Dispose(); } tempStoreSystem = null; lobStore = null; } }
public Application( IWebSocketCore webSocketCore, IConnectionService connectionService, ILoginSystem loginSystem, ICommandSystem commandSystem, IMovementSystem movementSystem, IChatSystem chatSystem, IStoreSystem storeSystem, ICombatSystem combatSystem, IInventorySystem inventorySystem, ILocationSender locationSender, IChatSender chatSender, IJoinSender joinSender) { _webSocketCore = webSocketCore; _connectionService = connectionService; _commandSystem = commandSystem; _movementSystem = movementSystem; _chatSystem = chatSystem; _storeSystem = storeSystem; _combatSystem = combatSystem; _inventorySystem = inventorySystem; _loginSystem = loginSystem; _locationSender = locationSender; _chatSender = chatSender; _joinSender = joinSender; }
public TableSourceComposite(Database database) { Database = database; tempStoreSystem = new InMemoryStorageSystem(); objectStates = new List<TransactionObjectState>(); StateStoreName = String.Format("{0}{1}", database.Name, StateStorePostfix); Setup(); }
public TableSourceComposite(Database database) { Database = database; tempStoreSystem = new InMemoryStorageSystem(); objectStates = new List <TransactionObjectState>(); StateStoreName = String.Format("{0}{1}", database.Name, StateStorePostfix); Setup(); }
internal TableSource(TableSystemV2 tableSystem, IStoreSystem storeSystem, int tableId, string sourceName) { TableSystem = tableSystem; StoreSystem = storeSystem; TableId = tableId; SourceName = sourceName; GC = new TableSourceGC(this); StoreName = MakeStoreName(tableId, sourceName); }
public TableSystemV2(IDatabase database, IStoreSystem storeSystem) { Database = database ?? throw new ArgumentNullException(nameof(database)); StoreSystem = storeSystem ?? throw new ArgumentNullException(nameof(storeSystem)); StateStoreName = $"{database.Name}{StateStorePostfix}"; ObjectStoreName = $"{database.Name}{LobPostfix}"; // TODO: Database.Consume(OnDatabaseEvent); Setup(); }
//public ITransaction CreateTransaction(TransactionIsolation isolation) { // var thisCommittedTables = new List<TableSource>(); // // Don't let a commit happen while we are looking at this. // lock (commitLock) { // long thisCommitId = CurrentCommitId; // var committedTableList = StateStore.GetVisibleList(); // thisCommittedTables.AddRange(committedTableList.Select(resource => GetTableSource(resource.TableId))); // // Create a set of IIndexSet for all the tables in this transaction. // var indexInfo = (thisCommittedTables.Select(mtable => mtable.CreateIndexSet())).ToList(); // // Create the transaction and record it in the open transactions list. // var t = new Transaction(this, thisCommitId, isolation, thisCommittedTables, indexInfo); // openTransactions.AddTransaction(t); // return t; // } //} private void Dispose(bool disposing) { if (disposing) { if (!IsClosed) { Close(); } if (lobStore != null) { lobStore.Dispose(); } if (stateStore != null) { stateStore.Dispose(); } if (tableSources != null) { foreach (var tableSource in tableSources) { tableSource.Value.Dispose(); } tableSources.Clear(); } if (StateStore != null) { StateStore.Dispose(); } if (LargeObjectStore != null) { LargeObjectStore.Dispose(); } if (tempStoreSystem != null) { tempStoreSystem.Dispose(); } } tableSources = null; StateStore = null; tempStoreSystem = null; lobStore = null; Database = null; }
private void InitStorageSystem() { try { var storageTypeName = Configuration.GetString("database.storageSystem", DefaultStorageSystemNames.Heap); StoreSystem = this.ResolveService <IStoreSystem>(storageTypeName); if (StoreSystem == null) { throw new DatabaseConfigurationException("The storage system for the database was not set."); } } catch (DatabaseConfigurationException) { throw; } catch (Exception ex) { throw new DatabaseConfigurationException("Could not initialize the storage system", ex); } }
//public ITransaction CreateTransaction(TransactionIsolation isolation) { // var thisCommittedTables = new List<TableSource>(); // // Don't let a commit happen while we are looking at this. // lock (commitLock) { // long thisCommitId = CurrentCommitId; // var committedTableList = StateStore.GetVisibleList(); // thisCommittedTables.AddRange(committedTableList.Select(resource => GetTableSource(resource.TableId))); // // Create a set of IIndexSet for all the tables in this transaction. // var indexInfo = (thisCommittedTables.Select(mtable => mtable.CreateIndexSet())).ToList(); // // Create the transaction and record it in the open transactions list. // var t = new Transaction(this, thisCommitId, isolation, thisCommittedTables, indexInfo); // openTransactions.AddTransaction(t); // return t; // } //} private void Dispose(bool disposing) { if (disposing) { if (!IsClosed) Close(); if (lobStore != null) lobStore.Dispose(); if (stateStore != null) stateStore.Dispose(); if (tempStoreSystem != null) tempStoreSystem.Dispose(); tempStoreSystem = null; lobStore = null; } }
//public ITransaction CreateTransaction(TransactionIsolation isolation) { // var thisCommittedTables = new List<TableSource>(); // // Don't let a commit happen while we are looking at this. // lock (commitLock) { // long thisCommitId = CurrentCommitId; // var committedTableList = StateStore.GetVisibleList(); // thisCommittedTables.AddRange(committedTableList.Select(resource => GetTableSource(resource.TableId))); // // Create a set of IIndexSet for all the tables in this transaction. // var indexInfo = (thisCommittedTables.Select(mtable => mtable.CreateIndexSet())).ToList(); // // Create the transaction and record it in the open transactions list. // var t = new Transaction(this, thisCommitId, isolation, thisCommittedTables, indexInfo); // openTransactions.AddTransaction(t); // return t; // } //} private void Dispose(bool disposing) { if (disposing) { if (!IsClosed) Close(); if (lobStore != null) lobStore.Dispose(); if (stateStore != null) stateStore.Dispose(); if (tableSources != null) { foreach (var tableSource in tableSources) { tableSource.Value.Dispose(); } tableSources.Clear(); } if (StateStore != null) StateStore.Dispose(); if (LargeObjectStore != null) LargeObjectStore.Dispose(); if (tempStoreSystem != null) tempStoreSystem.Dispose(); } tableSources = null; StateStore = null; tempStoreSystem = null; lobStore = null; Database = null; }
public InMemoryStoreTests() { storeSystem = new InMemoryStoreSystem(); }