package edit

import (
	

	
	
)

// A wrapper of histutil.Store that is concurrency-safe and supports an
// additional FastForward method.
type histStore struct {
	m  sync.Mutex
	db store.Store
	hs 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.Mutex
	c 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()
}