working commit

This commit is contained in:
2026-02-21 12:31:39 +02:00
parent 3220e2d78f
commit cd37a4508c
37 changed files with 354 additions and 319 deletions
+17 -17
View File
@@ -22,9 +22,9 @@ import (
"strings"
"mstore/pkg/auxtool"
"mstore/pkg/auxuuid"
"mstore/pkg/descr"
"mstore/pkg/term"
"mstore/pkg/auxid"
)
// FileInfo
@@ -41,9 +41,9 @@ type FileInfoResult struct {
ContentDigest string
ContentCreatedAt string
ContentCreatedBy uint64
ContentCreatedBy string
ContentUpdatedAt string
ContentUpdatedBy uint64
ContentUpdatedBy string
}
func cleanFilepath(filename string) (string, error) {
@@ -51,7 +51,7 @@ func cleanFilepath(filename string) (string, error) {
return filepath.Clean(filename), nil
}
func (oper *Operator) FileInfo(ctx context.Context, operatorID uint64, param *FileInfoParams) (int, *FileInfoResult, error) {
func (oper *Operator) FileInfo(ctx context.Context, operatorID string, param *FileInfoParams) (int, *FileInfoResult, error) {
var err error
code := http.StatusOK
res := &FileInfoResult{}
@@ -101,7 +101,7 @@ type PutFileResult struct{}
const defaultContentType = "application/octet-stream"
// TODO: checking catalog and file names conflict
func (oper *Operator) PutFile(ctx context.Context, operatorID uint64, param *PutFileParams) (int, *PutFileResult, error) {
func (oper *Operator) PutFile(ctx context.Context, operatorID string, param *PutFileParams) (int, *PutFileResult, error) {
var err error
res := &PutFileResult{}
@@ -155,7 +155,7 @@ func (oper *Operator) PutFile(ctx context.Context, operatorID uint64, param *Put
}
} else {
fileDescr = &descr.File{
ID: uuid.NewUUID(),
ID: auxuuid.NewUUID(),
Name: filename,
Collection: collection,
Size: size,
@@ -193,12 +193,12 @@ type GetFileResult struct {
Source io.ReadCloser
ContentCreatedAt string
ContentCreatedBy uint64
ContentCreatedBy string
ContentUpdatedAt string
ContentUpdatedBy uint64
ContentUpdatedBy string
}
func (oper *Operator) GetFile(ctx context.Context, operatorID uint64, param *GetFileParams) (int, *GetFileResult, error) {
func (oper *Operator) GetFile(ctx context.Context, operatorID string, param *GetFileParams) (int, *GetFileResult, error) {
var err error
res := &GetFileResult{}
@@ -247,7 +247,7 @@ type DeleteFileParams struct {
}
type DeleteFileResult struct{}
func (oper *Operator) DeleteFile(ctx context.Context, operatorID uint64, param *DeleteFileParams) (int, *DeleteFileResult, error) {
func (oper *Operator) DeleteFile(ctx context.Context, operatorID string, param *DeleteFileParams) (int, *DeleteFileResult, error) {
var err error
res := &DeleteFileResult{}
code := http.StatusOK
@@ -288,13 +288,13 @@ func (oper *Operator) DeleteFile(ctx context.Context, operatorID uint64, param *
// ListFiles
type ListFilesParams struct {
Filepath string
PathAs term.PathUsage `param:"pathAs"`
PathAs string `param:"pathAs"`
}
type ListFilesResult struct {
Files []descr.File `json:"files,omitempty"`
}
func (oper *Operator) ListFiles(ctx context.Context, operatorID uint64, params *ListFilesParams) (int, *ListFilesResult, error) {
func (oper *Operator) ListFiles(ctx context.Context, operatorID string, params *ListFilesParams) (int, *ListFilesResult, error) {
var err error
res := &ListFilesResult{
Files: make([]descr.File, 0),
@@ -400,13 +400,13 @@ func (oper *Operator) listFilesWithRegex(ctx context.Context, regex string) ([]d
// ListCollections
type ListCollectionsParams struct {
Path string
PathAS term.PathUsage `param:"pathAs"`
PathAS string `param:"pathAs"`
}
type ListCollectionsResult struct {
Collections []string `json:"collection,omitempty"`
}
func (oper *Operator) ListCollections(ctx context.Context, operatorID uint64, param *ListCollectionsParams) (int, *ListCollectionsResult, error) {
func (oper *Operator) ListCollections(ctx context.Context, operatorID string, param *ListCollectionsParams) (int, *ListCollectionsResult, error) {
var err error
res := &ListCollectionsResult{
Collections: make([]string, 0),
@@ -532,14 +532,14 @@ func (oper *Operator) listAllCollections(ctx context.Context) ([]string, error)
// DeleteColletion
type DeleteColletionParams struct {
Path string
PathAs term.PathUsage `param:"pathAs"`
DryRun bool `param:"dryRun"`
PathAs string `param:"pathAs"`
DryRun bool `param:"dryRun"`
}
type DeleteColletionResult struct {
Files []descr.File `json:"files,omitempty"`
}
func (oper *Operator) DeleteColletion(ctx context.Context, operatorID uint64, param *DeleteColletionParams) (int, *DeleteColletionResult, error) {
func (oper *Operator) DeleteColletion(ctx context.Context, operatorID string, param *DeleteColletionParams) (int, *DeleteColletionResult, error) {
var err error
res := &DeleteColletionResult{
Files: make([]descr.File, 0),