in progress

This commit is contained in:
2026-01-28 20:20:06 +03:00
parent a3e10b12ca
commit 1f63c5fbd4
5 changed files with 56 additions and 0 deletions

5
go.mod Normal file
View 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
View 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
View 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
View 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
View 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"`
}