server: adapt to store storeConfig architecture
- FlatDirStore alias points to store.Store interface - UtilStore/ExecStore/ToolStore embed interface not pointer - NewFlatDirStore/NewSkillStore return interfaces - Rename ChatInfo->LogInfo
This commit is contained in:
parent
6936c1c959
commit
d6bf477531
15
server.go
15
server.go
|
|
@ -30,8 +30,7 @@ type (
|
||||||
ReadWriteStore = store.ReadWriteStore
|
ReadWriteStore = store.ReadWriteStore
|
||||||
BlobStore = store.BlobStore
|
BlobStore = store.BlobStore
|
||||||
Store = store.Store
|
Store = store.Store
|
||||||
FlatDirStore = store.FlatDir
|
FlatDirStore = store.Store
|
||||||
SkillStore = store.SkillStore
|
|
||||||
BatchStore = store.BatchStore
|
BatchStore = store.BatchStore
|
||||||
BatchJobStore = store.BatchJobStore
|
BatchJobStore = store.BatchJobStore
|
||||||
Session = store.Session
|
Session = store.Session
|
||||||
|
|
@ -41,11 +40,11 @@ type (
|
||||||
syntheticFileInfo = store.SyntheticFileInfo
|
syntheticFileInfo = store.SyntheticFileInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewFlatDirStore(dir string, perm os.FileMode) *FlatDirStore {
|
func NewFlatDirStore(dir string, perm os.FileMode) FlatDirStore {
|
||||||
return store.NewFlatDir(dir, perm)
|
return store.NewFlatDir(dir, perm)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSkillStore() *SkillStore {
|
func NewSkillStore() Store {
|
||||||
return store.NewSkillStore()
|
return store.NewSkillStore()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +60,7 @@ func syntheticDirEntry(name string, mode os.FileMode) os.DirEntry {
|
||||||
|
|
||||||
// UtilStore is a FlatDirStore backed by the scripts/u/ directory.
|
// UtilStore is a FlatDirStore backed by the scripts/u/ directory.
|
||||||
type UtilStore struct {
|
type UtilStore struct {
|
||||||
*FlatDirStore
|
FlatDirStore
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUtilStore() *UtilStore {
|
func NewUtilStore() *UtilStore {
|
||||||
|
|
@ -84,7 +83,7 @@ func (s *UtilStore) Get(name string) ([]byte, error) {
|
||||||
|
|
||||||
// ExecStore is a read-only FlatDirStore backed by the scripts/x/ directory.
|
// ExecStore is a read-only FlatDirStore backed by the scripts/x/ directory.
|
||||||
type ExecStore struct {
|
type ExecStore struct {
|
||||||
*FlatDirStore
|
FlatDirStore
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewExecStore() *ExecStore {
|
func NewExecStore() *ExecStore {
|
||||||
|
|
@ -109,7 +108,7 @@ func (s *ExecStore) Get(name string) ([]byte, error) {
|
||||||
// It extends FlatDirStore with a synthetic "idx" entry that lists all tools
|
// It extends FlatDirStore with a synthetic "idx" entry that lists all tools
|
||||||
// with their descriptions and argument signatures.
|
// with their descriptions and argument signatures.
|
||||||
type ToolStore struct {
|
type ToolStore struct {
|
||||||
*FlatDirStore
|
FlatDirStore
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewToolStore() *ToolStore {
|
func NewToolStore() *ToolStore {
|
||||||
|
|
@ -1514,7 +1513,7 @@ func (s *Server) makeStat(path string) plan9.Dir {
|
||||||
if len(parts) == 3 && parts[0] == "s" {
|
if len(parts) == 3 && parts[0] == "s" {
|
||||||
if sess := s.sessionStore.Session(parts[1]); sess != nil {
|
if sess := s.sessionStore.Session(parts[1]); sess != nil {
|
||||||
if base == "chat" {
|
if base == "chat" {
|
||||||
length, vers := sess.ChatInfo()
|
length, vers := sess.LogInfo()
|
||||||
dir.Length = uint64(length)
|
dir.Length = uint64(length)
|
||||||
dir.Qid.Vers = vers
|
dir.Qid.Vers = vers
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue