forked from keybase/kbfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
status_file.go
35 lines (30 loc) · 966 Bytes
/
status_file.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
32
33
34
35
// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
package libdokan
import (
"time"
"github.com/keybase/kbfs/libfs"
"golang.org/x/net/context"
)
// NewNonTLFStatusFile returns a special read file that contains a
// text representation of the global KBFS status.
func NewNonTLFStatusFile(fs *FS) *SpecialReadFile {
return &SpecialReadFile{
read: func(ctx context.Context) ([]byte, time.Time, error) {
return libfs.GetEncodedStatus(ctx, fs.config)
},
fs: fs,
}
}
// NewTLFStatusFile returns a special read file that contains a text
// representation of the status of the current TLF.
func NewTLFStatusFile(folder *Folder) *SpecialReadFile {
return &SpecialReadFile{
read: func(ctx context.Context) ([]byte, time.Time, error) {
return libfs.GetEncodedFolderStatus(
ctx, folder.fs.config, folder.getFolderBranch())
},
fs: folder.fs,
}
}