Documentation
¶
Overview ¶
Package content owns the public directory scanner, manifest and safe file access. Public content is untrusted input and is read through os.Root.
Index ¶
- Constants
- Variables
- func EnsureLayout(dataDir string) error
- type Entry
- type Limits
- type Manifest
- type Skip
- type Snapshot
- type Store
- func (s *Store) Close() error
- func (s *Store) File(rel string) (*os.File, fs.FileInfo, error)
- func (s *Store) Invalidate()
- func (s *Store) Refresh(ctx context.Context) (*Snapshot, error)
- func (s *Store) Snapshot(ctx context.Context) (*Snapshot, error)
- func (s *Store) Warnings() []string
- func (s *Store) WriteFriends(data []byte) (bool, error)
Constants ¶
const ( CacheTTL = 30 * time.Second FirstScanWait = 3 * time.Second MaxManifestPage = 64 << 10 MaxManifestLimit = 200 DefaultManifestLimit = 100 )
Variables ¶
var ErrScanInProgress = errors.New("content: initial scan in progress")
Functions ¶
func EnsureLayout ¶
Types ¶
type Snapshot ¶
type Snapshot struct {
PeerID string
GeneratedAt time.Time
Entries []Entry
Total int
Warnings []string
Skipped []Skip
// FriendsSyncedAt is the mtime of friends.json, i.e. when its contents last
// changed. WriteFriends skips unchanged writes, so this is not the last time
// friends were synced.
FriendsSyncedAt time.Time
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Invalidate ¶
func (s *Store) Invalidate()
func (*Store) Refresh ¶
Refresh forces a new scan and waits for it. /published uses this so a user never sees a cached list after adding a file.