Ejemplo n.º 1
0
  public void Commit( CommitStage c )
  {
    if ( Saved ) return;

    if ( c == CommitStage.Prepare )
    {
      // Save the pages to the underlying stream.
      foreach ( G.KeyValuePair<long,IndexPage> pair in PageMap )
      {
        IndexPage p = pair.Value;
        if ( !p.Saved )
        {
          p.WriteHeader();
          F.Position = (long)p.PageId * IndexPage.PageSize;
        
          // For last page, only write the amount actually used (so file size is minimised)
          F.Write( p.Data, 0, p.PageId == PageAlloc-1 ? p.Size() : IndexPage.PageSize );
          p.Saved = true;
        }
      }
    }
    else if ( c == CommitStage.Rollback )
    {
      PageMap.Clear();
      Initialise();
    }
    else F.Commit( c );
    if ( c >= CommitStage.Flush ) Saved = true;
  }
Ejemplo n.º 2
0
  /* Private methods */

  void Commit( CommitStage c )
  {
    SysString.Commit( c );
    SysBinary.Commit( c );
    SysStringIndex.Commit( c );
    SysBinaryIndex.Commit( c );
    foreach( G.KeyValuePair<string,Schema> p in SchemaDict )
      foreach( G.KeyValuePair<string,TableExpression> q in p.Value.TableDict )
        q.Value.Commit( c );
  }
Ejemplo n.º 3
0
 public override void Commit(CommitStage c)
 {
     if (!Dirty)
     {
         return;
     }
     DataFile.Commit(c);
     foreach (G.KeyValuePair <long, IndexFile> p in IxDict)
     {
         p.Value.Commit(c);
     }
     if (c >= CommitStage.Flush)
     {
         Dirty = false;
     }
 }