GetDB() public method

public GetDB ( string filePath, string>.Dictionary options = null ) : DB
filePath string
options string>.Dictionary
return DB
示例#1
0
        public void Open(string storeName, string basePath = BASE_PATH, Dictionary <string, string> options = null)
        {
            this.storeName = storeName;
            DBLockManager manager = DBLockManager.Instance;

            if (!basePath.EndsWith("\\"))
            {
                basePath += "\\";
            }
            this.storeBasePath = basePath;

            // stores the revision history for a given document
            docStore = manager.GetDB(basePath + storeName + "\\docStore");

            // stores the specific revision id and data for a given document
            sequenceStore = manager.GetDB(basePath + storeName + "\\sequenceStore");

            attachStore       = manager.GetDB(basePath + storeName + "\\attachStore");
            attachBinaryStore = manager.GetDB(basePath + storeName + "\\attachBinaryStore");

            docCounter      = new DocCounter(basePath + storeName);
            docCount        = docCounter.Get();
            sequenceCounter = new SequenceCounter(basePath + storeName);
            sequenceCount   = sequenceCounter.Get();

            opened = true;
        }
示例#2
0
        public void Init(string storePath, string key, Dictionary <string, string> options = null)
        {
            DBLockManager lockManager = DBLockManager.Instance;

            store          = lockManager.GetDB(storePath);
            this.storePath = storePath;
        }
示例#3
0
        public void SetLastSync(string uri, long lastSync)
        {
            try
            {
                DBLockManager lockManager = DBLockManager.Instance;

                DB store = lockManager.GetDB(BASE_PATH + this.storeName);

                store.Put(WriteOptions.Default, uri, lastSync.ToString());
            }
            catch (Exception ee)
            {
                Debug.WriteLine(ee.ToString());
            }
        }
示例#4
0
        public long GetLastSync(string uri)
        {
            long result = 0;

            try
            {
                DBLockManager lockManager = DBLockManager.Instance;

                DB store = lockManager.GetDB(BASE_PATH + this.storeName);

                result = Convert.ToInt64(store.Get(ReadOptions.Default, uri));
            }
            catch (Exception ee)
            {
                Debug.WriteLine(ee.ToString());
            }

            return(result);
        }