コード例 #1
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);
            }
        }
コード例 #2
0
        private AvroRandomAccessWriter <V> GetWriter(string location)
        {
            if (File.Exists(location))
            {
                lock (mLocIndexes)
                {
                    AvroRandomAccessIndex <V> index;
                    mLocIndexes.TryGetValue(location, out index);
                    var writer = new AvroRandomAccessWriter <V>(ValueDef, location, index);
                    if (index == null)
                    {
                        mLocIndexes.Add(location, writer.Index);
                    }
                    return(writer);
                }
            }
            string directoryName = Path.GetDirectoryName(location);

            if (!Directory.Exists(directoryName))
            {
                Directory.CreateDirectory(directoryName);
            }
            return(new AvroRandomAccessWriter <V>(ValueDef, location, Codec));
        }