feat(fileindex): add file index top dependencies
This commit is contained in:
parent
0962ddb57c
commit
24f1516fd5
4 changed files with 39 additions and 0 deletions
1
go.mod
1
go.mod
|
@ -12,6 +12,7 @@ require (
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/ihexxa/gocfg v0.0.1
|
github.com/ihexxa/gocfg v0.0.1
|
||||||
github.com/ihexxa/multipart v0.0.0-20210916083128-8584a3f00d1d
|
github.com/ihexxa/multipart v0.0.0-20210916083128-8584a3f00d1d
|
||||||
|
github.com/ihexxa/q-radix/v3 v3.0.4 // indirect
|
||||||
github.com/jessevdk/go-flags v1.4.0
|
github.com/jessevdk/go-flags v1.4.0
|
||||||
github.com/json-iterator/go v1.1.11 // indirect
|
github.com/json-iterator/go v1.1.11 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.13 // indirect
|
github.com/mattn/go-isatty v0.0.13 // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -47,6 +47,8 @@ github.com/ihexxa/gocfg v0.0.1 h1:3zsCHY/SYdqKSoo3pwTBWMgivEB7/ctpPPHL3p43UBg=
|
||||||
github.com/ihexxa/gocfg v0.0.1/go.mod h1:oqDTq1ywx4Qi9DdhFwwMHoPCYv6Txrfj2SY5WWcgiJs=
|
github.com/ihexxa/gocfg v0.0.1/go.mod h1:oqDTq1ywx4Qi9DdhFwwMHoPCYv6Txrfj2SY5WWcgiJs=
|
||||||
github.com/ihexxa/multipart v0.0.0-20210916083128-8584a3f00d1d h1:+v33khYHVDPEuuWO/JE1IzhoIu5uNvEcSs5GmXc5Sjw=
|
github.com/ihexxa/multipart v0.0.0-20210916083128-8584a3f00d1d h1:+v33khYHVDPEuuWO/JE1IzhoIu5uNvEcSs5GmXc5Sjw=
|
||||||
github.com/ihexxa/multipart v0.0.0-20210916083128-8584a3f00d1d/go.mod h1:rhOAe/52S/J1fq1VnXvKX8FHuo65I+IcYUozW4M7+wE=
|
github.com/ihexxa/multipart v0.0.0-20210916083128-8584a3f00d1d/go.mod h1:rhOAe/52S/J1fq1VnXvKX8FHuo65I+IcYUozW4M7+wE=
|
||||||
|
github.com/ihexxa/q-radix/v3 v3.0.4 h1:Hk+Av57Q+fwFtHobd5uQjOFdY/V31nl4p+K4mO3crDg=
|
||||||
|
github.com/ihexxa/q-radix/v3 v3.0.4/go.mod h1:DYXQuLlICQ2pCdPQOzyovzSPq0P8sKwxv5HhVQAwSVQ=
|
||||||
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
|
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/ihexxa/quickshare/src/idgen"
|
"github.com/ihexxa/quickshare/src/idgen"
|
||||||
"github.com/ihexxa/quickshare/src/iolimiter"
|
"github.com/ihexxa/quickshare/src/iolimiter"
|
||||||
"github.com/ihexxa/quickshare/src/kvstore"
|
"github.com/ihexxa/quickshare/src/kvstore"
|
||||||
|
"github.com/ihexxa/quickshare/src/search/fileindex"
|
||||||
"github.com/ihexxa/quickshare/src/worker"
|
"github.com/ihexxa/quickshare/src/worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ type Deps struct {
|
||||||
workers worker.IWorkerPool
|
workers worker.IWorkerPool
|
||||||
boltStore *boltstore.BoltStore
|
boltStore *boltstore.BoltStore
|
||||||
cron cron.ICron
|
cron cron.ICron
|
||||||
|
fileIndex fileindex.IFileIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDeps(cfg gocfg.ICfg) *Deps {
|
func NewDeps(cfg gocfg.ICfg) *Deps {
|
||||||
|
@ -139,3 +141,11 @@ func (deps *Deps) Cron() cron.ICron {
|
||||||
func (deps *Deps) SetCron(cronImp cron.ICron) {
|
func (deps *Deps) SetCron(cronImp cron.ICron) {
|
||||||
deps.cron = cronImp
|
deps.cron = cronImp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (deps *Deps) FileIndex() fileindex.IFileIndex {
|
||||||
|
return deps.fileIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
func (deps *Deps) SetFileIndex(fileIndex fileindex.IFileIndex) {
|
||||||
|
deps.fileIndex = fileIndex
|
||||||
|
}
|
||||||
|
|
26
src/search/fileindex/trie_tree.go
Normal file
26
src/search/fileindex/trie_tree.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package fileindex
|
||||||
|
|
||||||
|
import (
|
||||||
|
qradix "github.com/ihexxa/q-radix/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FileTreeIndex struct {
|
||||||
|
*qradix.RTree
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFileTreeIndex() *FileTreeIndex {
|
||||||
|
return &FileTreeIndex{
|
||||||
|
RTree: qradix.NewRTree(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type IFileIndex interface {
|
||||||
|
FromString(input chan string) error
|
||||||
|
Get(key string) (interface{}, error)
|
||||||
|
GetAllPrefixMatches(key string) map[string]interface{}
|
||||||
|
GetBestMatch(key string) (string, interface{}, bool)
|
||||||
|
Insert(key string, val interface{}) (interface{}, error)
|
||||||
|
Remove(key string) bool
|
||||||
|
Size() int
|
||||||
|
String() chan string
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue