mirror of
https://github.com/gogrlx/bitcask.git
synced 2026-04-02 02:58:59 -07:00
Add support for keys with ttl (#177)
* ttl support first commit * imports fix * put api args correction * put options added * upgrade method added * upgrade log added * v0 to v1 migration script added * error assertion added * temp migration dir fix Co-authored-by: yash <yash.chandra@grabpay.com>
This commit is contained in:
committed by
GitHub
parent
f397bec88f
commit
5c6ceadac1
17
options.go
17
options.go
@@ -2,6 +2,7 @@ package bitcask
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/prologic/bitcask/internal/config"
|
||||
)
|
||||
@@ -26,6 +27,8 @@ const (
|
||||
DefaultSync = false
|
||||
|
||||
// DefaultAutoRecovery is the default auto-recovery action.
|
||||
|
||||
CurrentDBVersion = uint32(1)
|
||||
)
|
||||
|
||||
// Option is a function that takes a config struct and modifies it
|
||||
@@ -111,5 +114,19 @@ func newDefaultConfig() *config.Config {
|
||||
Sync: DefaultSync,
|
||||
DirFileModeBeforeUmask: DefaultDirFileModeBeforeUmask,
|
||||
FileFileModeBeforeUmask: DefaultFileFileModeBeforeUmask,
|
||||
DBVersion: CurrentDBVersion,
|
||||
}
|
||||
}
|
||||
|
||||
type Feature struct {
|
||||
Expiry *time.Time
|
||||
}
|
||||
|
||||
type PutOptions func(*Feature) error
|
||||
|
||||
func WithExpiry(expiry time.Time) PutOptions {
|
||||
return func(f *Feature) error {
|
||||
f.Expiry = &expiry
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user