Slight refactor for "release" tag

This commit is contained in:
kayos@tcp.direct 2022-02-12 00:11:09 -08:00
parent cbcbf42f5b
commit 2960ebcf1d
Signed by: kayos
GPG Key ID: 4B841471B4BEE979
3 changed files with 18 additions and 12 deletions

@ -3,7 +3,9 @@
[![Coverage](https://codecov.io/gh/yunginnanet/database/branch/master/graph/badge.svg)](https://codecov.io/gh/yunginnanet/database) [![Coverage](https://codecov.io/gh/yunginnanet/database/branch/master/graph/badge.svg)](https://codecov.io/gh/yunginnanet/database)
[![Build Status](https://github.com/yunginnanet/database/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/yunginnanet/database/actions/workflows/go.yml) [![Build Status](https://github.com/yunginnanet/database/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/yunginnanet/database/actions/workflows/go.yml)
--- `import "git.tcp.direct/kayos/database"`
## Documentation
#### type Filer #### type Filer
@ -36,14 +38,14 @@ store to satisfy an overencompassing interface.
type Keeper interface { type Keeper interface {
// Path should return the base path where all stores should be stored under. (likely as subdirectories) // Path should return the base path where all stores should be stored under. (likely as subdirectories)
Path() string Path() string
// Init should initialize our Filer at the given path, to be referenced and called by storeName. // Init should initialize our Filer at the given path, to be referenced and called by dataStore.
Init(storeName string) error Init(dataStore []byte) error
// With provides access to the given storeName by providing a pointer to the related Filer. // With provides access to the given dataStore by providing a pointer to the related Filer.
With(storeName string) Filer With(dataStore []byte) Filer
// Close should safely end any Filer operations of the given storeName and close any relevant handlers. // Close should safely end any Filer operations of the given dataStore and close any relevant handlers.
Close(storeName string) error Close(dataStore []byte) error
// Sync should take any volatile data and solidify it somehow if relevant. (ram to disk in most cases) // Sync should take any volatile data and solidify it somehow if relevant. (ram to disk in most cases)
Sync(storeName string) error Sync(dataStore []byte) error
CloseAll() error CloseAll() error
SyncAll() error SyncAll() error
@ -94,3 +96,4 @@ type Value interface {
``` ```
Value represents a value in a key/value Filer. Value represents a value in a key/value Filer.

@ -1,10 +1,13 @@
# bitcask # bitcask
`import "git.tcp.direct/kayos/database/bitcask"`
## Documentation
#### type DB #### type DB
```go ```go
type DB struct { type DB struct {}
}
``` ```
DB is a mapper of a Filer and Searcher implementation using Bitcask. DB is a mapper of a Filer and Searcher implementation using Bitcask.
@ -34,7 +37,7 @@ CloseAll closes all bitcask datastores.
#### func (*DB) Init #### func (*DB) Init
```go ```go
func (db *DB) Init(storeName string) error func (db *DB) Init(storeName string, bitcaskopts ...bitcask.Option) error
``` ```
Init opens a bitcask store at the given path to be referenced by storeName. Init opens a bitcask store at the given path to be referenced by storeName.

@ -44,7 +44,7 @@ func (db *DB) Init(storeName string, bitcaskopts ...bitcask.Option) error {
return errStoreExists return errStoreExists
} }
path := db.Path() path := db.Path()
if !strings.HasSuffix("/", db.Path()) { if !strings.HasSuffix(db.Path(), "/") {
path = db.Path() + "/" path = db.Path() + "/"
} }
c, e := bitcask.Open(path+storeName, bitcaskopts...) c, e := bitcask.Open(path+storeName, bitcaskopts...)