Ejemplo n.º 1
0
 public static KeyValueSet Open(Header h, FNodeSet Fields, AggregateSet CR)
 {
     RecordSet rs = BinarySerializer.BufferRecordSet(h.Path);
     KeyValueSet gbs = new KeyValueSet(Fields, CR);
     gbs.ImportFromInterim(rs);
     return gbs;
 }
Ejemplo n.º 2
0
 public static void Save(Header H, KeyValueSet Data)
 {
     RecordSet rs = Data.ToInterim();
     rs.Attach(H);
     BinarySerializer.FlushRecordSet(rs);
 }
Ejemplo n.º 3
0
 public static Header Save(string Dir, KeyValueSet Data)
 {
     RecordSet rs = Data.ToInterim();
     Header h = Header.TempHeader(Dir, rs);
     rs.Attach(h);
     BinarySerializer.FlushRecordSet(rs);
     return h;
 }
Ejemplo n.º 4
0
        // Statics //
        /// <summary>
        /// Takes all the records from T2 and merges into T1; if the record exists in T1, then:
        /// -- T1's record is updated
        /// -- T2's record is deleted
        /// Otherwise, if the record does not exist in T1, nothing happens
        /// </summary>
        /// <param name="T1"></param>
        /// <param name="T2"></param>
        public static void Union(KeyValueSet T1, KeyValueSet T2)
        {

            List<Record> Deletes = new List<Record>();

            // Merge and tag deletes //
            foreach (KeyValuePair<Record, CompoundRecord> t in T2._cache)
            {
                if (T1._cache.ContainsKey(t.Key))
                {
                    T1.Merge(t.Key, t.Value);
                    Deletes.Add(t.Key);
                }
            }

            // Clear deletes //
            foreach (Record r in Deletes)
                T2._cache.Remove(r);

        }
Ejemplo n.º 5
0
        // Methods //
        public void Insert()
        {

            // If the cache is full, then dump to disk
            if (this._Cache.IsFull)
            {

                // Create the interim data cache //
                Header h = KeyValueSet.Save(this._TempDir, this._Cache);
                this._Headers.Add(h);

                // Create new record set //
                this._Cache = new KeyValueSet(this._Cache.BaseMappers, this._Cache.BaseReducers);

            }

            // Add the record to the cache //
            this._Cache.Add();

        }
Ejemplo n.º 6
0
 // Constructor //
 public AggregateStructure(string TempDir, FNodeSet Fields, AggregateSet Aggregates, List<Header> Headers)
 {
     this._TempDir = TempDir;
     this._Cache = new KeyValueSet(Fields, Aggregates);
     this._Headers = new List<Header>();
     this._keys = Fields;
     this._aggregates = Aggregates;
 }