summaryrefslogtreecommitdiff
path: root/dist/log_data.py
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2013-08-13 16:51:35 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2013-08-13 16:51:35 +1000
commit34f5cae0091444529cf61332a705540f2ad3eb40 (patch)
tree43f4ba92bf0844a41d0fd8d4d67e59a69765809c /dist/log_data.py
parente5d1409635daa09b31d5edd374a95f61c6676143 (diff)
downloadmongo-34f5cae0091444529cf61332a705540f2ad3eb40.tar.gz
Update dist/log.py to generate code to read and write log records.
--HG-- rename : src/log/log_desc.c => src/log/log_auto.c
Diffstat (limited to 'dist/log_data.py')
-rw-r--r--dist/log_data.py40
1 files changed, 37 insertions, 3 deletions
diff --git a/dist/log_data.py b/dist/log_data.py
index 1e274e48991..7a3c99de50d 100644
--- a/dist/log_data.py
+++ b/dist/log_data.py
@@ -1,10 +1,44 @@
-# Data for config.py, describes all configuration key / value pairs
+# Data for log.py, describes the format of log records
+
+# There are a small number of main log record types.
+#
+# Some log record types, such as transaction commit, also include a list of
+# "log operations" within the same log record. Both log record types and log
+# operations are described here.
class LogRecordType:
def __init__(self, name, fields):
self.name = name
self.fields = fields
-types = [
- LogRecordType('debug', [('string', 'message')])
+ def macro_name(self):
+ return 'WT_LOGREC_%s' % self.name.upper()
+
+ def prname(self):
+ return '__logrec_print_' + self.name
+
+rectypes = [
+ LogRecordType('invalid', []),
+ LogRecordType('commit', [('uint64', 'txnid')]),
+ LogRecordType('debug', [('string', 'message')]),
+]
+
+class LogOperationType:
+ def __init__(self, name, fields):
+ self.name = name
+ self.fields = fields
+
+ def macro_name(self):
+ return 'WT_LOGOP_%s' % self.name.upper()
+
+optypes = [
+ LogRecordType('invalid', []),
+ LogOperationType('col_put',
+ [('string', 'uri'), ('recno', 'recno'), ('item', 'value')]),
+ LogOperationType('col_remove',
+ [('string', 'uri'), ('recno', 'recno')]),
+ LogOperationType('row_put',
+ [('string', 'uri'), ('item', 'key'), ('item', 'value')]),
+ LogOperationType('row_remove',
+ [('string', 'uri'), ('item', 'key')]),
]