Back to index

texmacs  1.0.7.15
Public Member Functions | Private Member Functions | Private Attributes | Friends
disk_table_rep Class Reference

#include <disk_table.hpp>

Inheritance diagram for disk_table_rep:
Inheritance graph
[legend]
Collaboration diagram for disk_table_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 disk_table_rep (url root2)
 ~disk_table_rep ()
void write (transaction t)
transaction read (collection keys)

Private Member Functions

void open_pending_write ()
void close_pending_write ()
void flush_pending_write ()
void flush_pending_read ()

Private Attributes

url root
FILE * pending_fp
transaction pending_write
transaction pending_read
transaction read_cache
int ref_count

Friends

class disk_table

Detailed Description

Definition at line 22 of file disk_table.hpp.


Constructor & Destructor Documentation

Definition at line 142 of file disk_table.cpp.

                                        : root (root2) {
  if (!exists (root)) mkdir (root);
  if (exists (root * "pending")) {
    string s;
    load_string (root * "pending", s, true);
    transaction t= disk_decode_transaction (s);
    write_to_disk (root, t);
    remove (root * "pending");
  }
  open_pending_write ();
}

Here is the call graph for this function:

Definition at line 154 of file disk_table.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 173 of file disk_table.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 189 of file disk_table.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 178 of file disk_table.cpp.

                                     {
  if (N (pending_write) > 10000) {
    write_to_disk (root, pending_write);
    pending_write= transaction ();
    close_pending_write ();
    remove (root * "pending");
    open_pending_write ();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 159 of file disk_table.cpp.

                                    {
  string name= concretize (root * "pending");
  char* _name= as_charp (name);
#ifdef OS_WIN32
  pending_fp= _fopen (_name, "ab");
#else
  pending_fp= fopen (_name, "a");
#endif
  if (pending_fp == NULL)
    FAILED ("cannot store pending writes file for TeXmacs file system");
  tm_delete_array (_name);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 333 of file disk_table.cpp.

                                     {
  transaction done;
  collection  remaining;
  iterator<string> it= iterate (keys);
  while (it->busy ()) {
    string s= it->next ();
    if (keys [s] > 0 && keys [s] < 3) {
      if (pending_read->contains (s))
       done (s)= pending_read [s];
      else if (read_cache->contains (s))
       done (s)= read_cache [s];
      else remaining (s)= keys [s];
    }
    else remaining (s)= keys [s];
  }

  transaction extra= read_from_disk (root, remaining, 0);
  it= iterate (remaining);
  while (it->busy ()) {
    string s= it->next ();
    if (remaining [s] > 0 && remaining [s] < 3)
      pending_read (s)= extra [s];
  }
  flush_pending_read ();
  return done * extra;
}

Here is the call graph for this function:

Definition at line 262 of file disk_table.cpp.

                                    {
  transaction pending;
  transaction r;
  iterator<string> it= iterate (t);
  while (it->busy ()) {
    string s= it->next ();
    collection val= t[s];
    if (N (filter (val, true)) == 0) pending (s)= val;
    else r (s)= val;
  }

  string app= disk_encode_transaction (pending);
  int i, n= N(app);
  for (i=0; i<n; i++)
    fputc (app[i], pending_fp);
  fflush (pending_fp);
  merge (pending_write, pending);
  merge (pending_read, pending);
  write_to_disk (root, r);

  flush_pending_write ();
  flush_pending_read ();
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class disk_table [friend]

Definition at line 41 of file disk_table.hpp.


Member Data Documentation

FILE* disk_table_rep::pending_fp [private]

Definition at line 25 of file disk_table.hpp.

Definition at line 27 of file disk_table.hpp.

Definition at line 26 of file disk_table.hpp.

Definition at line 28 of file disk_table.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.

Definition at line 24 of file disk_table.hpp.


The documentation for this class was generated from the following files: