internal async Task EnsureStores(IObjectStore parentStore, LocalRecordStoreTable recordStoreTable)
        {
            m_root = await parentStore.CreateChildStoreAsync(m_record.ID);

            IObjectStore child;

            child = await m_root.CreateChildStoreAsync("Data");

            LocalItemStore itemStore = new LocalItemStore(child, (recordStoreTable != null) ? recordStoreTable.ItemCache : null);

            child = await m_root.CreateChildStoreAsync("Changes");

            RecordItemChangeTable changeTable = new RecordItemChangeTable(child, null);

            m_dataStore = new SynchronizedStore(m_record, itemStore, changeTable);

            child = await m_root.CreateChildStoreAsync("Metadata");

            m_metadataStore = new LocalStore(child);

            child = await m_root.CreateChildStoreAsync("Blobs");

            m_blobs = new LocalStore(child);

            m_synchronizedTypes = new SynchronizedTypeManager(this);
        }
Beispiel #2
0
 public RecordItemChangeManager(SynchronizedStore store, RecordItemChangeTable changeTable)
 {
     if (store == null)
     {
         throw new ArgumentNullException("store");
     }
     if (changeTable == null)
     {
         throw new ArgumentNullException("changeTable");
     }
     m_store            = store;
     m_changeTable      = changeTable;
     m_errorHandler     = new RecordItemCommitErrorHandler();
     m_workerController = new WorkerController();
 }
        public SynchronizedView(SynchronizedStore store, ViewData data)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            m_store = store;
            m_data = data;
            m_typeVersions = new HashSet<string>(m_data.Query.View.TypeVersions);
        }
 public RecordItemChangeManager(SynchronizedStore store, RecordItemChangeTable changeTable)
 {
     if (store == null)
     {
         throw new ArgumentNullException("store");
     }
     if (changeTable == null)
     {
         throw new ArgumentNullException("changeTable");
     }
     m_store = store;
     m_changeTable = changeTable;
     m_errorHandler = new RecordItemCommitErrorHandler();
     m_workerController = new WorkerController();
 }
        public SynchronizedView(SynchronizedStore store, ViewData data)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            m_store = store;
            m_data = data;
            this.ReadAheadMode = SynchronizedViewReadAheadMode.Page;
        }
        public SynchronizedView(SynchronizedStore store, ViewData data)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            m_store            = store;
            m_data             = data;
            this.ReadAheadMode = SynchronizedViewReadAheadMode.Page;
        }
Beispiel #7
0
        public IAsyncAction NewItemAsync(RecordItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            SynchronizedStore.PrepareForNew(item);

            return(AsyncInfo.Run(async cancelToken =>
            {
                RecordItemLock rlock = m_itemLocks.AcquireItemLock(item.ID);
                if (rlock != null)
                {
                    using (rlock)
                    {
                        await this.PutItemAsync(item, rlock);
                    }
                }
            }));
        }
Beispiel #8
0
        /// <summary>
        /// Add a new item. The item is saved in the local store immediately, and a pending commit to the remote store is put in
        /// the synchronized store's change queue
        /// </summary>
        public IAsyncAction AddNewAsync(IItemDataTyped item)
        {
            this.ValidateItem(item);

            RecordItem recordItem = item.Item;

            SynchronizedStore.PrepareForNew(recordItem);

            return(AsyncInfo.Run(async cancelToken => {
                RecordItemLock rlock = this.AcquireItemLock(recordItem.Key);
                if (rlock == null)
                {
                    return;
                }

                using (rlock)
                {
                    await this.Data.PutItemAsync(recordItem, rlock);
                    await this.AddKeyAsync(recordItem);
                }

                this.StartCommitChanges();
            }));
        }
 public SynchronizedView(SynchronizedStore store, ItemQuery query, string name)
     : this(store, new ViewData(query, name))
 {
 }
        internal async Task EnsureFolders(IObjectStore parentStore, LocalRecordStoreTable recordStoreTable)
        {
            IObjectStore root = await parentStore.CreateChildStoreAsync(m_record.ID);

            IObjectStore child;

            child = await root.CreateChildStoreAsync("Data");

            var itemStore = new LocalItemStore(child, (recordStoreTable != null) ? recordStoreTable.ItemCache : null);
            m_dataStore = new SynchronizedStore(m_record, itemStore);

            child = await root.CreateChildStoreAsync("Metadata");
            m_metadataStore = new LocalStore(child);

            child = await root.CreateChildStoreAsync("Blobs");
            m_blobs = new LocalStore(child);
        }
 public SynchronizedView(SynchronizedStore store, ItemQuery query, string name)
     : this(store, new ViewData(query, name))
 {
 }