From 1f63c5fbd48ee6e86eff84f22fa4d8a4fb72b073 Mon Sep 17 00:00:00 2001 From: Maksimov V Vladimir Date: Wed, 28 Jan 2026 20:20:06 +0300 Subject: [PATCH] in progress --- go.mod | 5 +++++ go.sum | 2 ++ ifs.go | 26 ++++++++++++++++++++++++++ models/dir.go | 11 +++++++++++ models/file.go | 12 ++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 go.mod create mode 100644 go.sum create mode 100644 ifs.go create mode 100644 models/dir.go create mode 100644 models/file.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..900dc68 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.gm6.ru/icewind/pfs + +go 1.25.4 + +require github.com/google/uuid v1.6.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..7790d7c --- /dev/null +++ b/go.sum @@ -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= diff --git a/ifs.go b/ifs.go new file mode 100644 index 0000000..cea1085 --- /dev/null +++ b/ifs.go @@ -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) +} diff --git a/models/dir.go b/models/dir.go new file mode 100644 index 0000000..a4de588 --- /dev/null +++ b/models/dir.go @@ -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"` +} diff --git a/models/file.go b/models/file.go new file mode 100644 index 0000000..663c0df --- /dev/null +++ b/models/file.go @@ -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"` +}