18 using System.Collections.Generic;
20 namespace Deveel.Data.Store {
24 public const int DefaultStoreSize = 1024;
27 nameStoreMap =
new Dictionary<string, InMemoryStore>();
36 GC.SuppressFinalize(
this);
41 if (nameStoreMap != null) {
55 return nameStoreMap.ContainsKey(name);
60 return CreateStore(name, DefaultStoreSize);
64 return CreateStore(name, DefaultStoreSize);
68 if (String.IsNullOrEmpty(name))
69 throw new ArgumentNullException(
"name");
72 if (StoreExists(name))
73 throw new ArgumentException(String.Format(
"The store {0} already exists.", name));
76 nameStoreMap[name] = store;
84 if (!nameStoreMap.TryGetValue(name, out store))
85 throw new InvalidOperationException(String.Format(
"Store {0} does not exist.", name));
92 return OpenStore(name);
100 if (!StoreExists(store.
Name))
101 throw new InvalidOperationException(String.Format(
"Store {0} does not exist", store.
Name));
112 throw new ArgumentNullException(
"store");
115 return nameStoreMap.Remove(store.
Name);
123 public void Lock(
string lockName) {
void Unlock(string lockName)
bool DeleteStore(InMemoryStore store)
string Name
Gets the unique name of the store within the application.
IStore CreateStore(String name)
Creates and returns a new persistent Store object given the unique name of the store.
InMemoryStore CreateStore(string name)
An object that creates and manages the IStore objects that the database engine uses to represent itse...
An implementation of IStore that persists data in the application memory.
void Lock(string lockName)
bool StoreExists(string name)
void Dispose(bool disposing)
bool CloseStore(InMemoryStore store)
bool CloseStore(IStore store)
Closes a store that has been either created or opened with the CreateStore or OpenStore methods...
IStore OpenStore(String name)
Opens an existing persistent Store object in the system and returns the IStore object that contains i...
void SetCheckPoint()
Sets a new check point at the current state of this store system.
bool DeleteStore(IStore store)
Permanently deletes a store from the system - use with care!
Dictionary< string, InMemoryStore > nameStoreMap
InMemoryStore CreateStore(string name, int hashSize)
A store is a resource where areas can be allocated and freed to store information (a memory allocator...
InMemoryStore OpenStore(string name)