Ejemplo n.º 1
0
        public void Init(string storePath, string key, Dictionary <string, string> options = null)
        {
            DBLockManager lockManager = DBLockManager.Instance;

            store          = lockManager.GetDB(storePath);
            this.storePath = storePath;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
 public virtual void Close()
 {
     if (store != null)
     {
         DBLockManager lockManager = DBLockManager.Instance;
         lockManager.Close(storePath);
         store = null;
     }
 }
Ejemplo n.º 4
0
        public void Close()
        {
            DBLockManager manager = DBLockManager.Instance;

            manager.Close(BASE_PATH + storeName + "\\docStore");
            manager.Close(BASE_PATH + storeName + "\\sequenceStore");
            manager.Close(BASE_PATH + storeName + "\\attachStore");
            manager.Close(BASE_PATH + storeName + "\\attachBinaryStore");
            manager.Close(BASE_PATH + storeName);
        }
Ejemplo n.º 5
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());
            }
        }
Ejemplo n.º 6
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);
        }