Commit 8c736e77 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent fa68b9e4
......@@ -5,7 +5,7 @@
package main
import (
"../../storage" // XXX rel ok?
_ "../../storage" // XXX rel ok?
)
......
This diff is collapsed.
......@@ -3,8 +3,13 @@
// filestorage support XXX text
package storage
import (
"os"
. "../"
)
type FileStorage struct {
fd int
f *os.File // XXX naming -> file ?
}
// IStorage
......@@ -36,32 +41,32 @@ type DataRec struct {
}
func (TxnRecHead *rh) MarshalFS() []byte {
func (rh *TxnRecHead) MarshalFS() []byte {
panic("TODO")
}
func (TxnRecHead *rh) UnmarshalFS(data []byte) {
TODO
func (rh *TxnRecHead) UnmarshalFS(data []byte) {
//TODO
}
func NewFileStorage(path string) (*FileStorage, error) {
fd, err := ...Open(path, O_RDONLY)
f, err := os.Open(path) // note opens in O_RDONLY
if err != nil {
return nil, err
}
// TODO read file header
Read(fd, 4) != "FS21" -> invalid header
return &FileStorage{fd: fd}
//Read(f, 4) != "FS21" -> invalid header
return &FileStorage{f: f}, nil
}
func (f *FileStorage) Close() error {
err := Os.Close(f.fd)
err := f.f.Close()
if err != nil {
return err
}
f.fd = -1
f.f = nil
return nil
}
......@@ -70,5 +75,6 @@ func (f *FileStorage) Iterate(start, stop Tid) IStorageIterator {
panic("TODO start/stop support")
}
// TODO
return nil
}
......@@ -18,10 +18,13 @@ const (
INVALID_TID Tid = 1<<64 - 1 // 0xffffffffffffffff TODO recheck it is the same
INVALID_OID Oid = 0xffffffffffffffff // 1<<64 - 1
ZERO_TID Tid = 0 // XXX or simply TID{} ? // XXX -> TID0 ?
TID0 Tid = ZERO_TID // XXX ^^^ choose 1
ZERO_OID Oid = 0 // XXX or simply OID{} ? // XXX -> OID0
// OID_LEN = 8
// TID_LEN = 8
MAX_TID Tid = 0x7fffffffffffffff // SQLite does not accept numbers above 2^63-1 // XXX -> TIDMAX ?
TIDMAX Tid = MAX_TID // XXX ^^^ choose 1
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment