-
Notifications
You must be signed in to change notification settings - Fork 0
/
stat.go
31 lines (25 loc) · 1.04 KB
/
stat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cas
import (
"context"
"os"
"github.com/hemantthanna/cas/storage/local"
"github.com/hemantthanna/cas/types"
)
// Stat returns the size of the file and the ref if it's written into the metadata and considered valid.
func Stat(ctx context.Context, path string) (SizedRef, error) {
return local.Stat(ctx, path)
}
// StatFile returns the size of the file and the ref if it's written into the metadata and considered valid.
func StatFile(ctx context.Context, f *os.File) (SizedRef, error) {
return local.StatFile(ctx, f)
}
// SaveRef stores the ref into file's metadata.
// Additionally, it will write the size and mtime to know if ref is still valid.
func SaveRef(ctx context.Context, path string, fi os.FileInfo, ref types.Ref) error {
return local.SaveRef(ctx, path, fi, ref)
}
// SaveRefFile stores the ref into file's metadata.
// Additionally, it will write the size and mtime to know if ref is still valid.
func SaveRefFile(ctx context.Context, f *os.File, fi os.FileInfo, ref types.Ref) error {
return local.SaveRefFile(ctx, f, fi, ref)
}