github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libfs/status_file.go (about) 1 // Copyright 2015-2016 Keybase Inc. All rights reserved. 2 // Use of this source code is governed by a BSD 3 // license that can be found in the LICENSE file. 4 5 package libfs 6 7 import ( 8 "time" 9 10 "github.com/keybase/client/go/kbfs/data" 11 "github.com/keybase/client/go/kbfs/libkbfs" 12 "github.com/keybase/client/go/kbfs/tlf" 13 "golang.org/x/net/context" 14 ) 15 16 // GetEncodedFolderStatus returns serialized JSON containing status information 17 // for a folder 18 func GetEncodedFolderStatus(ctx context.Context, config libkbfs.Config, 19 folderBranch data.FolderBranch) ( 20 data []byte, t time.Time, err error) { 21 var status libkbfs.FolderBranchStatus 22 status, _, err = config.KBFSOps().FolderStatus(ctx, folderBranch) 23 if err != nil { 24 return nil, time.Time{}, err 25 } 26 27 data, err = PrettyJSON(status) 28 return 29 } 30 31 // GetEncodedStatus returns serialized JSON containing top-level KBFS status 32 // information 33 func GetEncodedStatus(ctx context.Context, config libkbfs.Config) ( 34 data []byte, t time.Time, err error) { 35 status, _, err := config.KBFSOps().Status(ctx) 36 if err != nil { 37 config.Reporter().ReportErr(ctx, "", tlf.Private, libkbfs.ReadMode, err) 38 return nil, t, err 39 } 40 data, err = PrettyJSON(status) 41 return 42 }