Exemple #1
0
        private Slice CreateMappedResultKey(int view, string reduceKey)
        {
            var sliceWriter = new SliceWriter(12);

            sliceWriter.WriteBigEndian(view);
            sliceWriter.WriteBigEndian(Hashing.XXHash64.CalculateRaw(reduceKey));

            return(sliceWriter.CreateSlice());
        }
Exemple #2
0
        private Slice CreateScheduleReductionKey(int view, int level, string reduceKey)
        {
            var sliceWriter = new SliceWriter(16);

            sliceWriter.WriteBigEndian(view);
            sliceWriter.WriteBigEndian(level);
            sliceWriter.WriteBigEndian(Hashing.XXHash64.CalculateRaw(reduceKey));

            return(sliceWriter.CreateSlice());
        }
Exemple #3
0
        private Slice CreateReduceResultsWithBucketKey(int view, string reduceKey, int level, int bucket)
        {
            var sliceWriter = new SliceWriter(20);

            sliceWriter.WriteBigEndian(view);
            sliceWriter.WriteBigEndian(Hashing.XXHash64.CalculateRaw(reduceKey));
            sliceWriter.WriteBigEndian(level);
            sliceWriter.WriteBigEndian(bucket);

            return(sliceWriter.CreateSlice());
        }
Exemple #4
0
        protected Slice CreateViewKey(int view)
        {
            var sliceWriter = new SliceWriter(4);

            sliceWriter.WriteBigEndian(view);
            return(sliceWriter.CreateSlice());
        }
Exemple #5
0
        private Slice CreateBucketAndEtagKey(int bucket, Etag id)
        {
            var sliceWriter = new SliceWriter(20);

            sliceWriter.WriteBigEndian(bucket);
            sliceWriter.Write(id.ToByteArray());
            return(sliceWriter.CreateSlice());
        }
Exemple #6
0
        private Slice GetNextEtagKey()
        {
            var nextEtag  = ++lastEtag;
            var keyWriter = new SliceWriter(keyBuffer);

            keyWriter.WriteBigEndian(nextEtag);
            return(keyWriter.CreateSlice());
        }
Exemple #7
0
        public void DeleteIndexEntry(long id)
        {
            var sliceWriter = new SliceWriter(8);

            sliceWriter.WriteBigEndian(id);
            _currentDocumentIdSlice = sliceWriter.CreateSlice();

            _writeBatch.Add(_currentDocumentIdSlice, Stream.Null, "deletes");
        }
Exemple #8
0
 public static Slice ToSlice(this long val, ByteStringContext context)
 {
     lock (_writerSync)             //precaution, should be uncontested
     {
         _int64Writer.Reset();
         _int64Writer.WriteBigEndian(val);
         return(_int64Writer.CreateSlice(context));
     }
 }
Exemple #9
0
        public void Commit()
        {
            ThrowIfDisposed();

            if (_hasIdChanged)
            {
                var valueWriter = new SliceWriter(sizeof(long));
                valueWriter.WriteBigEndian(_nextId);
                MetadataTree.Add(_nextIdKey, valueWriter.CreateSlice(_storage.ByteStringContext));
            }

            _tx.Commit();
        }
Exemple #10
0
        public void NewIndexEntry()
        {
            if (AutoFlush && _writeBatch.Size() > FlushThresholdBytes)
            {
                Flush();
            }

            CurrentDocumentId = _parent.NextDocumentId();
            var sliceWriter = new SliceWriter(8);

            sliceWriter.WriteBigEndian(CurrentDocumentId);
            _currentDocumentIdSlice = sliceWriter.CreateSlice();
            _writeBatch.Add(_currentDocumentIdSlice, Stream.Null, "docs");
        }
 private Slice CreateMappedResultWithBucketKey(int view, string reduceKey, int bucket)
 {
     var sliceWriter = new SliceWriter(16);
     sliceWriter.WriteBigEndian(view);
     sliceWriter.WriteBigEndian(Hashing.XXHash64.CalculateRaw(reduceKey));
     sliceWriter.WriteBigEndian(bucket);
    
     return sliceWriter.CreateSlice();
 }
        private Slice CreateReduceResultsKey(int view, string reduceKey, int level)
        {
            var sliceWriter = new SliceWriter(16);
            sliceWriter.WriteBigEndian(view);
            sliceWriter.WriteBigEndian(Hashing.XXHash64.CalculateRaw(reduceKey));
            sliceWriter.WriteBigEndian(level);


            return sliceWriter.CreateSlice();
        }
	    private Slice CreateBucketAndEtagKey(int bucket, Etag id)
	    {
	        var sliceWriter = new SliceWriter(20);
	        sliceWriter.WriteBigEndian(bucket);
            sliceWriter.Write(id.ToByteArray());
	        return sliceWriter.CreateSlice();
	    }