Esempio n. 1
0
 public BatchOperation(Slice key, Stream value, string treeName, BatchOperationType type)
 {
     Key      = key;
     Value    = value;
     TreeName = treeName;
     Type     = type;
 }
Esempio n. 2
0
 private BatchOperation(Slice key, ushort?version, string treeName, BatchOperationType type)
 {
     Key      = key;
     Version  = version;
     TreeName = treeName;
     Type     = type;
 }
 BatchOperationWorkItem(
     BatchOperationType type,
     Object serializedObject
     )
 {
     this._type             = type;
     this._serializedObject = serializedObject;
 }
 internal BatchMessage(IBaseMessage message, object userData, BatchOperationType oppType,
                       SftpReceiveProperties.AfterGetActions afterGetAction, string afterGetFilename)
 {
     this._message          = message;
     this._userData         = userData;
     this._operationType    = oppType;
     this._aftergetaction   = afterGetAction;
     this._aftergetfilename = afterGetFilename;
 }
 internal BatchMessage(IBaseMessage message, object userData, BatchOperationType oppType,
                       SftpReceiveProperties.AfterGetActions afterGetAction, string afterGetFilename)
 {
     Message          = message;
     UserData         = userData;
     OperationType    = oppType;
     AfterGetAction   = afterGetAction;
     AfterGetFilename = afterGetFilename;
 }
 internal BatchMessage(IBaseMessage message, object userData, BatchOperationType oppType)
 {
     Message       = message;
     UserData      = userData;
     OperationType = oppType;
 }
Esempio n. 7
0
        internal bool TryGetValue(string treeName, Slice key, out Stream value, out ushort?version, out BatchOperationType operationType)
        {
            value         = null;
            version       = null;
            operationType = BatchOperationType.None;

            if (treeName == null)
            {
                treeName = Constants.RootTreeName;
            }

            //first check if it is a multi-tree operation
            Dictionary <Slice, List <BatchOperation> > treeOperations;

            if (_multiTreeOperations.TryGetValue(treeName, out treeOperations))
            {
                List <BatchOperation> operationRecords;
                if (treeOperations.TryGetValue(key, out operationRecords))
                {
                    //since in multi-tree there are many operations for single tree key, then fetching operation type and value is meaningless
                    return(true);
                }
            }

            Dictionary <Slice, BatchOperation> operations;

            if (_lastOperations.TryGetValue(treeName, out operations) == false)
            {
                return(false);
            }

            BatchOperation operation;

            if (operations.TryGetValue(key, out operation))
            {
                operationType = operation.Type;
                version       = operation.Version;

                if (operation.Type == BatchOperationType.Delete)
                {
                    return(true);
                }

                value = operation.Value as Stream;
                operation.Reset();                 // will reset stream position

                if (operation.Type == BatchOperationType.Add)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 8
0
 public BatchOperation(Slice key, Slice value, ushort?version, string treeName, BatchOperationType type)
     : this(key, value as object, version, treeName, type)
 {
     if (value != null)
     {
         originalStreamPosition = 0;
         ValueSize = value.Size;
     }
 }
Esempio n. 9
0
            public BatchOperation(Slice key, Stream value, ushort?version, string treeName, BatchOperationType type)
                : this(key, value as object, version, treeName, type)
            {
                if (value != null)
                {
                    originalStreamPosition = value.Position;
                    ValueSize = value.Length;

                    reset = () => value.Position = originalStreamPosition;
                }
            }
Esempio n. 10
0
            private BatchOperation(Slice key, Stream value, ushort?version, string treeName, BatchOperationType type)
                : this(key, value as object, version, treeName, type)
            {
                if (value != null)
                {
                    originalStreamPosition = value.Position;
                    ValueSize = value.Length;

                    reset = () => value.Position = originalStreamPosition;
                }

#if DEBUG
                stackTrace = new StackTrace();
#endif
            }
 internal BatchMessage(IBaseMessage message, object userData, BatchOperationType oppType)
 {
     this._message       = message;
     this._userData      = userData;
     this._operationType = oppType;
 }
Esempio n. 12
0
            private BatchOperation(Slice key, Slice value, ushort?version, string treeName, BatchOperationType type)
                : this(key, version, treeName, type)
            {
                if (value != null)
                {
                    ValueSize = value.Size;
                }

                ValueSlice = value;
            }
Esempio n. 13
0
            private BatchOperation(Slice key, Stream value, ushort?version, string treeName, BatchOperationType type)
                : this(key, version, treeName, type)
            {
                if (value != null)
                {
                    _originalStreamPosition = value.Position;
                    ValueSize = value.Length;
                }

                ValueStream = value;
            }
Esempio n. 14
0
 public BatchMessage(string correlationToken, object userData, BatchOperationType oppType)
 {
     this.correlationToken = correlationToken;
     this.userData         = userData;
     this.operationType    = oppType;
 }
Esempio n. 15
0
 public BatchMessage(IBaseMessage message, object userData, BatchOperationType oppType)
 {
     this.message       = message;
     this.userData      = userData;
     this.operationType = oppType;
 }
 internal BatchMessage(string correlationToken, object userData, BatchOperationType oppType)
 {
     this._correlationToken = correlationToken;
     this._userData         = userData;
     this._operationType    = oppType;
 }
 internal BatchMessage(string correlationToken, object userData, BatchOperationType oppType)
 {
     CorrelationToken = correlationToken;
     UserData         = userData;
     OperationType    = oppType;
 }
Esempio n. 18
0
 private BatchOperation(Slice key, IStructure value, ushort?version, string treeName, BatchOperationType type)
     : this(key, version, treeName, type)
 {
     ValueStruct = value;
 }