Exemplo n.º 1
0
        //private void Apply_ReadCallback(long handle, bool exist, Path path, IKey key, IRecord record)
        //{
        //    if (!Path.Equals(path))
        //        return;

        //    if (PendingRead != null)
        //        PendingRead(handle, exist, path, key, record);
        //}

        //private void Read(IKey key, long handle)
        //{
        //    InternalExecute(new ReadOperation(key, handle));
        //}

        private void InternalExecute(IOperation operation)
        {
            if (operations.Capacity == 0)
            {
                StorageEngine.Execute(Locator, operation);
                return;
            }

            operations.Add(operation);
            if (operations.Count == operations.Capacity)
            {
                Flush();
            }
        }
Exemplo n.º 2
0
        private void InternalExecute(IOperation operation)
        {
            if (operations.Capacity == 0)
            {
                OperationCollection oprs = new OperationCollection(Locator, 1);
                oprs.Add(operation);

                var result = StorageEngine.Execute(oprs);
                SetResult(operations, result);

                return;
            }

            operations.Add(operation);
            if (operations.Count == operations.Capacity || operation.IsSynchronous)
            {
                Flush();
            }
        }
Exemplo n.º 3
0
        //~XIndex()
        //{
        //    Flush();
        //}

        //private void Apply_ReadCallback(long handle, bool exist, Path path, IKey key, IRecord record)
        //{
        //    if (!Path.Equals(path))
        //        return;

        //    if (PendingRead != null)
        //        PendingRead(handle, exist, path, key, record);
        //}

        //private void Read(IKey key, long handle)
        //{
        //    InternalExecute(new ReadOperation(key, handle));
        //}

        private void Execute(IOperation operation)
        {
            lock (SyncRoot)
            {
                IsModified = true;

                if (operations.Capacity == 0)
                {
                    Tree.Execute(Locator, operation);
                    return;
                }

                operations.Add(operation);
                if (operations.Count == operations.Capacity)
                {
                    Flush();
                }
            }
        }