diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-26 15:29:06 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-01-26 15:29:06 -0700 |
commit | 1baa6d576a5f13a55d81c83a167efe0953c0d143 (patch) | |
tree | 83f10236ee028b8e6ef559a6ca53f1d81ad39cba /rwtransaction.go | |
parent | Remove RWCursor. (diff) | |
download | dedo-1baa6d576a5f13a55d81c83a167efe0953c0d143.tar.gz dedo-1baa6d576a5f13a55d81c83a167efe0953c0d143.tar.xz |
Initialize transaction/rwtransaction.
Diffstat (limited to 'rwtransaction.go')
-rw-r--r-- | rwtransaction.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/rwtransaction.go b/rwtransaction.go index 2c0837f..b0123f5 100644 --- a/rwtransaction.go +++ b/rwtransaction.go @@ -5,8 +5,15 @@ package bolt type RWTransaction struct { Transaction - dirtyPages map[int]*page - freelist []pgno + dirtyPages map[pgid]*page + freelist []pgid +} + +// init initializes the transaction and associates it with a database. +func (t *RWTransaction) init(db *DB, meta *meta) { + t.dirtyPages = make(map[pgid]*page) + t.freelist = make([]pgid) + t.Transaction.init(db, meta) } // TODO: Allocate scratch meta page. @@ -232,3 +239,12 @@ func (t *RWTransaction) allocate(count int) (*page, error) { // TODO: If no free pages are available, resize the mmap to allocate more. return nil, nil } + + +func (t *RWTransaction) insert(key []byte, data []byte) error { + // TODO: If there is not enough space on page for key+data then split. + // TODO: Move remaining data on page forward. + // TODO: Write leaf node to current location. + // TODO: Adjust available page size. + return nil +} |