From b7677fa515e331dcdde491444ba960e8372c24e6 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 12 Dec 2019 10:24:06 +0100 Subject: [PATCH] wip License: MIT Signed-off-by: Henrique Dias --- coreapi.go | 3 +++ files.go | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 files.go diff --git a/coreapi.go b/coreapi.go index 12cb166..8a47360 100644 --- a/coreapi.go +++ b/coreapi.go @@ -16,6 +16,9 @@ type CoreAPI interface { // Unixfs returns an implementation of Unixfs API Unixfs() UnixfsAPI + // Files returns an implementation of Files API. + Files() FilesAPI + // Block returns an implementation of Block API Block() BlockAPI diff --git a/files.go b/files.go new file mode 100644 index 0000000..228642e --- /dev/null +++ b/files.go @@ -0,0 +1,33 @@ +package iface + +import ( + "context" + "os" + + "github.com/ipfs/go-cid" +) + +type FileInfo interface { + os.FileInfo + CID() cid.Cid +} + +type FilesAPI interface { + Stat(ctx context.Context, path string) (FileInfo, error) +} + +/* AFERO interface for reference + +Chmod(name string, mode os.FileMode) : error +Chtimes(name string, atime time.Time, mtime time.Time) : error +Create(name string) : File, error +Mkdir(name string, perm os.FileMode) : error +MkdirAll(path string, perm os.FileMode) : error +Name() : string +Open(name string) : File, error +OpenFile(name string, flag int, perm os.FileMode) : File, error +Remove(name string) : error +RemoveAll(path string) : error +Rename(oldname, newname string) : error +Stat(name string) : os.FileInfo, error +*/