Source File
hist_store.go
Belonging Package
src.elv.sh/pkg/edit
package editimport ()// A wrapper of histutil.Store that is concurrency-safe and supports an// additional FastForward method.type histStore struct {m sync.Mutexdb store.Storehs histutil.Store}func ( store.Store) (*histStore, error) {, := histutil.NewHybridStore()return &histStore{db: , hs: },}func ( *histStore) ( store.Cmd) (int, error) {.m.Lock()defer .m.Unlock()return .hs.AddCmd()}func ( *histStore) () ([]store.Cmd, error) {.m.Lock()defer .m.Unlock()return .hs.AllCmds()}func ( *histStore) ( string) histutil.Cursor {.m.Lock()defer .m.Unlock()return cursor{&.m, histutil.NewDedupCursor(.hs.Cursor())}}func ( *histStore) () error {.m.Lock()defer .m.Unlock(), := histutil.NewHybridStore(.db).hs =return}type cursor struct {m *sync.Mutexc histutil.Cursor}func ( cursor) () {.m.Lock()defer .m.Unlock().c.Prev()}func ( cursor) () {.m.Lock()defer .m.Unlock().c.Next()}func ( cursor) () (store.Cmd, error) {.m.Lock()defer .m.Unlock()return .c.Get()}
The pages are generated with Golds v0.2.8-preview. (GOOS=darwin GOARCH=arm64)