wrip
This commit is contained in:
34
server/internal/adapters/interface.go
Normal file
34
server/internal/adapters/interface.go
Normal file
@@ -0,0 +1,34 @@
|
||||
// Package adapters are the backend to that connects the marka server to a storage
|
||||
package adapters
|
||||
|
||||
import "time"
|
||||
|
||||
type FileAdapter interface {
|
||||
Read(path string) (FsResponse, error)
|
||||
Write(path string, content []byte) error
|
||||
}
|
||||
|
||||
type FsFile struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Content []byte `json:"content"`
|
||||
ModTime time.Time `json:"modTime"`
|
||||
}
|
||||
|
||||
type FsDirEntry struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
IsDir bool `json:"isDir,omitempty"`
|
||||
ModTime time.Time `json:"modTime"`
|
||||
}
|
||||
|
||||
type FsDir struct {
|
||||
Files []FsDirEntry `json:"files"`
|
||||
Name string `json:"name"`
|
||||
ModTime time.Time `json:"modTime"`
|
||||
}
|
||||
|
||||
type FsResponse struct {
|
||||
Dir *FsDir `json:"dir,omitempty"`
|
||||
File *FsFile `json:"file,omitempty"`
|
||||
}
|
Reference in New Issue
Block a user