~tokyocabinet/tokyocabinet/jmansion-1.3.22-win32port

« back to all changes in this revision

Viewing changes to tchdb.h

  • Committer: Baptiste Lepilleur
  • Date: 2009-07-30 19:18:20 UTC
  • Revision ID: blep@users.sourceforge.net-20090730191820-39v7rhqpb68x5bpc
Tags: tokyocabinet-1.3.20
releaseĀ 1.3.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
  void *mmtx;                            /* mutex for method */
57
57
  void *rmtxs;                           /* mutexes for records */
58
58
  void *dmtx;                            /* mutex for the while database */
 
59
  void *tmtx;                            /* mutex for transaction */
 
60
  void *wmtx;                            /* mutex for write ahead logging */
59
61
  void *eckey;                           /* key for thread specific error code */
60
62
  uint8_t type;                          /* database type */
61
63
  uint8_t flags;                         /* additional flags */
98
100
  bool fatal;                            /* whether a fatal error occured */
99
101
  uint64_t inode;                        /* inode number */
100
102
  time_t mtime;                          /* modification time */
 
103
  bool tran;                             /* whether in the transaction */
 
104
  int walfd;                             /* file descriptor of write ahead logging */
 
105
  uint64_t walend;                       /* end offset of write ahead logging */
101
106
  int dbgfd;                             /* file descriptor for debugging */
102
107
  int64_t cnt_writerec;                  /* tesing counter for record write times */
103
108
  int64_t cnt_reuserec;                  /* tesing counter for record reuse times */
134
139
  HDBOCREAT = 1 << 2,                    /* writer creating */
135
140
  HDBOTRUNC = 1 << 3,                    /* writer truncating */
136
141
  HDBONOLCK = 1 << 4,                    /* open without locking */
137
 
  HDBOLCKNB = 1 << 5                     /* lock without blocking */
 
142
  HDBOLCKNB = 1 << 5,                    /* lock without blocking */
 
143
  HDBOTSYNC = 1 << 6                     /* synchronize every transaction */
138
144
};
139
145
 
140
146
 
221
227
   `omode' specifies the connection mode: `HDBOWRITER' as a writer, `HDBOREADER' as a reader.
222
228
   If the mode is `HDBOWRITER', the following may be added by bitwise or: `HDBOCREAT', which
223
229
   means it creates a new database if not exist, `HDBOTRUNC', which means it creates a new
224
 
   database regardless if one exists.  Both of `HDBOREADER' and `HDBOWRITER' can be added to by
 
230
   database regardless if one exists, `HDBOTSYNC', which means every transaction synchronizes
 
231
   updated contents with the device.  Both of `HDBOREADER' and `HDBOWRITER' can be added to by
225
232
   bitwise or: `HDBONOLCK', which means it opens the database file without file locking, or
226
233
   `HDBOLCKNB', which means locking is performed without blocking.
227
234
   If successful, the return value is true, else, it is false. */
528
535
bool tchdbcopy(TCHDB *hdb, const char *path);
529
536
 
530
537
 
 
538
/* Begin the transaction of a hash database object.
 
539
   `hdb' specifies the hash database object connected as a writer.
 
540
   If successful, the return value is true, else, it is false.
 
541
   The database is locked by the thread while the transaction so that only one transaction can be
 
542
   activated with a database object at the same time.  Thus, the serializable isolation level is
 
543
   assumed if every database operation is performed in the transaction.  All updated regions are
 
544
   kept track of by write ahead logging while the transaction.  If the database is closed during
 
545
   transaction, the transaction is aborted implicitly. */
 
546
bool tchdbtranbegin(TCHDB *hdb);
 
547
 
 
548
 
 
549
/* Commit the transaction of a hash database object.
 
550
   `hdb' specifies the hash database object connected as a writer.
 
551
   If successful, the return value is true, else, it is false.
 
552
   Update in the transaction is fixed when it is committed successfully. */
 
553
bool tchdbtrancommit(TCHDB *hdb);
 
554
 
 
555
 
 
556
/* Abort the transaction of a hash database object.
 
557
   `hdb' specifies the hash database object connected as a writer.
 
558
   If successful, the return value is true, else, it is false.
 
559
   Update in the transaction is discarded when it is aborted.  The state of the database is
 
560
   rollbacked to before transaction. */
 
561
bool tchdbtranabort(TCHDB *hdb);
 
562
 
 
563
 
531
564
/* Get the file path of a hash database object.
532
565
   `hdb' specifies the hash database object.
533
566
   The return value is the path of the database file or `NULL' if the object does not connect to
590
623
 
591
624
 
592
625
/* Clear the cache of a hash tree database object.
593
 
   `bdb' specifies the hash tree database object.
 
626
   `hdb' specifies the hash tree database object.
594
627
   If successful, the return value is true, else, it is false. */
595
628
bool tchdbcacheclear(TCHDB *hdb);
596
629
 
727
760
char *tchdbgetnext2(TCHDB *hdb, const char *kstr);
728
761
 
729
762
 
 
763
/* Void the transaction of a hash database object.
 
764
   `hdb' specifies the hash database object connected as a writer.
 
765
   If successful, the return value is true, else, it is false.
 
766
   This function should be called only when no update in the transaction. */
 
767
bool tchdbtranvoid(TCHDB *hdb);
 
768
 
 
769
 
730
770
 
731
771
__TCHDB_CLINKAGEEND
732
772
#endif                                   /* duplication check */