コード例 #1
0
        public void AddDocuments(DateTime time, IEnumerable <V> valueList)
        {
            var writers = new Dictionary <string, AvroRandomAccessWriter <V> >();

            try
            {
                foreach (V value in valueList)
                {
                    string key      = ValueDef.GetValueKey(value);
                    string location = ValueLocationStrategy.GetLocation(time, key);

                    AvroRandomAccessWriter <V> writer;
                    if (!writers.TryGetValue(location, out writer))
                    {
                        writer = GetWriter(location);
                        writers.Add(location, writer);
                    }
                    writer.Write(value);
                    lock (mMasterIndex)
                    {
                        mMasterIndex.Add(Guid.Parse(key), location);
                    }
                }
            }
            finally
            {
                foreach (KeyValuePair <string, AvroRandomAccessWriter <V> > pair in writers)
                {
                    pair.Value.Dispose();
                }
            }
        }
コード例 #2
0
        public override void Write(V value)
        {
            Preconditions.CheckNotNullArgument(value);
            GenericRecord record   = ValueDef.GetRecord(value);
            long          position = mWriter.Sync();

            mWriter.Append(record);
            Index.AddEntry(ValueDef.GetValueKey(value), position);
        }
コード例 #3
0
        public void AddValue(DateTime time, V value)
        {
            string key      = ValueDef.GetValueKey(value);
            string location = ValueLocationStrategy.GetLocation(time, key);

            using (AvroRandomAccessWriter <V> writer = GetWriter(location))
            {
                writer.Write(value);
            };
            lock (mMasterIndex)
            {
                mMasterIndex.Add(Guid.Parse(key), location);
            }
        }