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); } }
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)); }