This commit is contained in:
royalcat 2024-03-18 00:00:34 +03:00
parent 35913e0190
commit 6a1e338af4
34 changed files with 1900 additions and 355 deletions
cmd
generate-graphql
tstor

View file

@ -10,14 +10,14 @@ import (
"github.com/99designs/gqlgen/codegen/config"
)
type plugin_ struct {
type fieldDirectiveFix struct {
}
func (plugin_) Name() string {
func (fieldDirectiveFix) Name() string {
return "Fix Directive hook called with wrong object"
}
func (plugin_) GenerateCode(cfg *codegen.Data) error {
func (fieldDirectiveFix) GenerateCode(cfg *codegen.Data) error {
for _, input := range cfg.Inputs {
for _, field := range input.Fields {
if field.GoFieldType == codegen.GoFieldVariable {
@ -56,7 +56,7 @@ func main() {
}
err = api.Generate(cfg,
api.AddPlugin(&plugin_{}),
api.AddPlugin(&fieldDirectiveFix{}),
)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())

View file

@ -15,7 +15,7 @@ import (
"git.kmsign.ru/royalcat/tstor/src/config"
"git.kmsign.ru/royalcat/tstor/src/host"
"git.kmsign.ru/royalcat/tstor/src/host/filestorage"
"git.kmsign.ru/royalcat/tstor/src/host/datastorage"
"git.kmsign.ru/royalcat/tstor/src/host/service"
"git.kmsign.ru/royalcat/tstor/src/host/store"
"git.kmsign.ru/royalcat/tstor/src/host/vfs"
@ -90,13 +90,13 @@ func run(configPath string) error {
return fmt.Errorf("error creating node ID: %w", err)
}
st, _, err := filestorage.Setup(conf.TorrentClient)
st, _, err := datastorage.Setup(conf.TorrentClient)
if err != nil {
return err
}
defer st.Close()
excludedFilesStore, err := store.NewExcludedFiles(conf.TorrentClient.MetadataFolder, st)
excludedFilesStore, err := store.NewFileMappings(conf.TorrentClient.MetadataFolder, st)
if err != nil {
return err
}
@ -238,5 +238,5 @@ func run(configPath string) error {
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
<-sigChan
return nil
return ts.Close()
}