Пример #1
0
        public void AddDocument(T document, bool clearDocumentRefs = true)
        {
            if (document == null)
            {
                throw new Exception("Document is null");
            }

            var doc = GetDocument(document, clearDocumentRefs);

            int temporyCount = 0;
            DocumentPartition partition;

            if (doc.Exists)
            {
                partition = new DocumentPartition(doc.Partition, doc.Exists);
            }
            else
            {
                if (IsPartialStore)
                {
                    temporyCount = Queue.Count(d => d.PartOf.Partition == Meta.Partitions.Current);
                    partition    = Meta.GetPartition(Meta.Partitions.Current, PartialStoreLimit, temporyCount);
                }
                else
                {
                    partition = new DocumentPartition(Meta.Partitions.Current, doc.Exists);
                }
            }

            Enqueue(doc, partition);
        }
Пример #2
0
        private void Enqueue(Document document, DocumentPartition partOf)
        {
            document.Partition = partOf.Partition;

            var queue = new DocumentQueue(document, partOf);

            Queue.Enqueue(queue);

            if (Partitions.Count(p => p.Partition == partOf.Partition && p.Operation == partOf.Operation) == 0)
            {
                Partitions.Enqueue(partOf);
            }
        }
Пример #3
0
 public IEnumerable <Block> GetAllBlocks()
 {
     return(DocumentPartition.GetAllBlocks()
            .Concat(SprocPartition.GetAllBlocks()));
 }
Пример #4
0
 public DocumentQueue(Document document, DocumentPartition partOf)
 {
     Document = document;
     PartOf   = partOf;
 }