Back to looking at raw binary

This commit is contained in:
Sandy Walsh 2014-03-22 01:56:47 -03:00
parent d4be446cf5
commit ef8fc4237e
2 changed files with 26 additions and 14 deletions

View File

@ -4,8 +4,8 @@ import tables
class KeyValue(tables.IsDescription):
key = tables.StringCol(itemsize=22, dflt=" ", pos=0)
value = tables.StringCol(itemsize=22, dflt=" ", pos=0)
key = tables.StringCol(itemsize=250, dflt=" ", pos=0)
value = tables.VLStringAtom() # StringCol(itemsize=22, dflt=" ", pos=0)
def make_notification():
@ -23,7 +23,9 @@ fileh = tables.open_file("storeage.h5", mode = "w")
root = fileh.root
notifications = fileh.create_group(root, "notifications")
notification = fileh.create_table(notifications, "notification", KeyValue)
notification = fileh.create_table(notifications, "notification",
tables.StringCol(itemsize=250, dflt=" ", pos=0))
vlarray = fileh.createVLArray(notifications, 'vlarray8', tables.VLStringAtom(), "Variable Length String")
row = notification.row

View File

@ -14,24 +14,33 @@
# limitations under the License.
import datetime
import struct
"""Binary data archiving library.
Data is written in the following format:
[HEADER]
[PAYLOAD]
[FOOTER]
[ENTRY] =
<START-OF-BLOCK> byte # 0x05
<BLOCK-TYPE> long # new versions get new block-types
<CRC> ulong
<SIZE> long
where:
[HEADER] =
[START-OF-BLOCK]
[BLOCK-TYPE]
[SIZE]
[PAYLOAD] =
<START-OF-PAYLOAD> byte # 0x06
<RECORD_COUNT> int
[RECORD, RECORD, ...]
[FOOTER] =
[CRC]
[END-OF-BLOCK]
[RECORD] =
<SIZE> long
<KEY> varstr (%s)
<TYPE> int
<UNION>
<BOOLEAN>
<INT>
<FLOAT>
<DATETIME>
<STRING>
There are ArchiveReaders and ArchiveWriters which are managed
by RollManager. The RollManager opens and closes Archivers as
@ -162,6 +171,7 @@ class ArchiveWriter(Archive):
self._handle = open(filename, "wb+")
def write(self, payload):
pass