github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libfuse/status_file.go (about)

     1  // Copyright 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  //go:build !windows
     6  // +build !windows
     7  
     8  package libfuse
     9  
    10  import (
    11  	"time"
    12  
    13  	"golang.org/x/net/context"
    14  
    15  	"github.com/keybase/client/go/kbfs/libfs"
    16  )
    17  
    18  // NewNonTLFStatusFile returns a special read file that contains a
    19  // text representation of the global KBFS status.
    20  func NewNonTLFStatusFile(fs *FS, entryValid *time.Duration) *SpecialReadFile {
    21  	*entryValid = 0
    22  	return &SpecialReadFile{
    23  		read: func(ctx context.Context) ([]byte, time.Time, error) {
    24  			return libfs.GetEncodedStatus(ctx, fs.config)
    25  		},
    26  	}
    27  }