Ejemplo n.º 1
0
        public V GetValue(DateTime time, string key)
        {
            AvroRandomAccessReader <V> reader = GetReader(ValueLocationStrategy.GetLocation(time, key));

            if (reader == null)
            {
                throw new Exception(string.Format("Document could not be located: {0} - {1}", time, key));
            }
            return(reader.Get(key));
        }
Ejemplo n.º 2
0
        public bool TryGetDocument(DateTime time, string key, out V value)
        {
            AvroRandomAccessReader <V> reader = GetReader(ValueLocationStrategy.GetLocation(time, key));

            if (reader != null)
            {
                value = reader.Get(key);
                return(true);
            }
            value = default(V);
            return(false);
        }
Ejemplo n.º 3
0
 private AvroRandomAccessReader <V> GetReader(string location)
 {
     if (File.Exists(location))
     {
         lock (mLocIndexes)
         {
             AvroRandomAccessIndex <V> index;
             mLocIndexes.TryGetValue(location, out index);
             var reader = new AvroRandomAccessReader <V>(ValueDef, location, index);
             if (index == null)
             {
                 mLocIndexes.Add(location, reader.Index);
             }
             return(reader);
         }
     }
     return(null);
 }