An implementation of IStore that persists data in the application memory.
상속: IStore
예제 #1
0
 public void TestSetUp()
 {
     storageSystem = new InMemoryStorageSystem();
     testStore = storageSystem.CreateStore("TestStore");
     objStore = new ObjectStore(1, testStore);
     objStore.Create();
 }
예제 #2
0
        public bool CloseStore(InMemoryStore store)
        {
            if (!StoreExists(store.Name))
                throw new InvalidOperationException(String.Format("Store {0} does not exist", store.Name));

            return true;
        }
        public bool DeleteStore(InMemoryStore store)
        {
            if (store == null)
                throw new ArgumentNullException("store");

            lock (this) {
                return nameStoreMap.Remove(store.Name);
            }
        }
예제 #4
0
        public bool CloseStore(InMemoryStore store)
        {
            if (!StoreExists(store.Name))
            {
                throw new InvalidOperationException(String.Format("Store {0} does not exist", store.Name));
            }

            return(true);
        }
예제 #5
0
        public bool DeleteStore(InMemoryStore store)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }

            lock (this) {
                return(nameStoreMap.Remove(store.Name));
            }
        }
예제 #6
0
        public InMemoryStore CreateStore(string name, int hashSize)
        {
            if (String.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            lock (this) {
                if (StoreExists(name))
                    throw new ArgumentException(String.Format("The store {0} already exists.", name));

                var store = new InMemoryStore(name, hashSize);
                nameStoreMap[name] = store;
                return store;
            }
        }
예제 #7
0
        public bool DeleteStore(InMemoryStore store)
        {
            if (store == null)
                throw new ArgumentNullException("store");

            lock (this) {
                InMemoryStore removed;
                if (!nameStoreMap.TryGetValue(store.Name, out removed))
                    return false;

                nameStoreMap.Remove(store.Name);

                if (removed != null)
                    removed.Dispose();

                return true;
            }
        }
예제 #8
0
        public InMemoryStore CreateStore(string name, int hashSize)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            lock (this) {
                if (StoreExists(name))
                {
                    throw new ArgumentException(String.Format("The store {0} already exists.", name));
                }

                var store = new InMemoryStore(name, hashSize);
                nameStoreMap[name] = store;
                return(store);
            }
        }
예제 #9
0
        public bool DeleteStore(InMemoryStore store)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }

            lock (this) {
                InMemoryStore removed;
                if (!nameStoreMap.TryGetValue(store.Name, out removed))
                {
                    return(false);
                }

                nameStoreMap.Remove(store.Name);

                if (removed != null)
                {
                    removed.Dispose();
                }

                return(true);
            }
        }