in progress
This commit is contained in:
5
go.mod
Normal file
5
go.mod
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module git.gm6.ru/icewind/pfs
|
||||||
|
|
||||||
|
go 1.25.4
|
||||||
|
|
||||||
|
require github.com/google/uuid v1.6.0
|
||||||
2
go.sum
Normal file
2
go.sum
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
26
ifs.go
Normal file
26
ifs.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.gm6.ru/icewind/pfs/models"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type IFSStat struct {
|
||||||
|
ID uuid.UUID
|
||||||
|
Name string
|
||||||
|
IsDir bool
|
||||||
|
Created time.Time
|
||||||
|
LastModified time.Time
|
||||||
|
OwnerID uuid.UUID
|
||||||
|
}
|
||||||
|
|
||||||
|
type IFS interface {
|
||||||
|
DirCreate(dir *models.Dir, userID uuid.UUID) error
|
||||||
|
DirRemove(dirID uuid.UUID, userID uuid.UUID) error
|
||||||
|
DirRead(dirID uuid.UUID, userID uuid.UUID) ([]IFSStat, error)
|
||||||
|
FileCreate(file *models.File) error
|
||||||
|
FileRemove(fileID uuid.UUID, userID uuid.UUID) error
|
||||||
|
FileRead(fileID uuid.UUID, userID uuid.UUID) (*models.File, error)
|
||||||
|
}
|
||||||
11
models/dir.go
Normal file
11
models/dir.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "github.com/google/uuid"
|
||||||
|
|
||||||
|
type Dir struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
ParentID *uuid.UUID `json:"parent_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
OwnerID uuid.UUID `json:"owner_id"`
|
||||||
|
IsPublic bool `json:"is_public"`
|
||||||
|
}
|
||||||
12
models/file.go
Normal file
12
models/file.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "github.com/google/uuid"
|
||||||
|
|
||||||
|
type File struct {
|
||||||
|
ID uuid.UUID `json:"id"`
|
||||||
|
DirID *uuid.UUID `json:"dir_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
OwnerID uuid.UUID `json:"owner_id"`
|
||||||
|
IsPublic bool `json:"is_public"`
|
||||||
|
Data []byte `json:"data"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user