MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / New

Function New

lib/wal/wal.go:33–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33func New() (*Wal, error) {
34 log, err := wal.Open(FileName, nil)
35 if err != nil {
36 return &Wal{}, err
37 }
38 index, err := log.LastIndex()
39 if err != nil {
40 return &Wal{}, err
41 }
42 if index == 0 {
43 err := log.Write(1, []byte("--------------------"))
44 if err != nil {
45 return &Wal{}, err
46 }
47 }
48 return &Wal{log: log}, nil
49}

Callers 4

TestNewFunction · 0.85
TestWal_WriteFunction · 0.85
TestWal_ReadFunction · 0.85
TestWal_ReadLastFunction · 0.85

Calls 2

WriteMethod · 0.65
LastIndexMethod · 0.45

Tested by 4

TestNewFunction · 0.68
TestWal_WriteFunction · 0.68
TestWal_ReadFunction · 0.68
TestWal_ReadLastFunction · 0.68