26 lines
525 B
Go
26 lines
525 B
Go
|
package storeserver
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
|
||
|
"github.com/google/uuid"
|
||
|
// "git.keganmyers.com/terribleplan/file-store/pkg/proto"
|
||
|
)
|
||
|
|
||
|
func ValidateFileId(fileId string) error {
|
||
|
if _, err := uuid.Parse(fileId); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
type StoreServer interface {
|
||
|
ListFiles(ListFilesFn) error
|
||
|
ReadFile(string) ([]byte, error)
|
||
|
WriteFile(fileId string, meta []byte) error
|
||
|
DeleteFile(fileId string) error
|
||
|
WriteChunk(fileId string, chunkId uint16, data io.ReadCloser) error
|
||
|
}
|
||
|
|
||
|
type ListFilesFn func(string) error
|