CreateSequentialUuid() public static method

public static CreateSequentialUuid ( ) : System.Guid
return System.Guid
        public Guid AddDocument(string key, Guid?etag, JObject data, JObject metadata)
        {
            var docPos = Mutator.Documents.FindValue(key);

            EnsureNotLockedByAnotherTransaction(key, Guid.Empty);

            if (docPos == null)
            {
                var max     = Mutator.DocumentsById.GetRightMost();
                var current = max.Type == JTokenType.Null ? 0 : max.Value <int>();
                var docId   = current + 1;
                metadata["@docId"] = new JValue(docId);
                var docKeyPos = Writer.Position;
                BinaryWriter.Write(key);
                Mutator.DocumentsById.Add(docId, docKeyPos);
                Mutator.IncrementDocumentCount();
            }
            else
            {
                var oldEtag = EnsureValidEtag(docPos.Value, etag);
                Mutator.DocumentsByEtag.Remove(oldEtag);
            }
            var  newEtag  = DocumentDatabase.CreateSequentialUuid();
            long position = WriteDocument(key, metadata, newEtag, data);

            Mutator.Documents.Add(key, position);
            Mutator.DocumentsByEtag.Add(newEtag.ToByteArray(), position);
            return(newEtag);
        }
        public Guid AddDocumentInTransaction(string key, Guid?etag, JObject data, JObject metadata, TransactionInformation transactionInformation)
        {
            BeforeWorkingWithDocumentInsideTransaction(key, transactionInformation, etag);

            metadata["@locking_tx"] = new JValue(transactionInformation.Id.ToString());
            var  newEtag  = DocumentDatabase.CreateSequentialUuid();
            long position = WriteDocument(key, metadata, newEtag, data);

            Mutator.DocumentsInTransaction.Add(GetDocInTxKey(key, transactionInformation.Id), position);
            return(newEtag);
        }
        public void DeleteDocumentInTransaction(TransactionInformation transactionInformation, string key, Guid?etag)
        {
            BeforeWorkingWithDocumentInsideTransaction(key, transactionInformation, etag);
            var pos = Writer.Position;

            BinaryWriter.Write(key);
            new JObject(
                new JProperty("@deleted_in_tx", true),
                new JProperty("@etag", DocumentDatabase.CreateSequentialUuid().ToString())
                ).WriteTo(new BsonWriter(Writer));
            new JObject().WriteTo(new BsonWriter(Writer));
            Mutator.DocumentsInTransaction.Add(GetDocInTxKey(key, transactionInformation.Id), pos);
        }
        public void AddAttachment(string key, Guid?etag, byte[] data, JObject headers)
        {
            var attachmentPosition = Mutator.Attachments.FindValue(key);

            headers["@etag"] = new JValue(DocumentDatabase.CreateSequentialUuid().ToString());
            if (attachmentPosition == null)
            {
                Mutator.IncrementAttachmentCount();
            }
            else
            {
                EnsureValidEtag(key, attachmentPosition.Value, etag);
            }

            var position = Writer.Position;

            headers.WriteTo(new BsonWriter(Writer));
            BinaryWriter.Write7BitEncodedInt(data.Length);
            Writer.Write(data, 0, data.Length);
            Mutator.Attachments.Add(key, position);
            logger.DebugFormat("Adding attachment {0}", key);
        }