Skip to content

Commit

Permalink
Add more exported type comments
Browse files Browse the repository at this point in the history
  • Loading branch information
djherbis committed Oct 24, 2020
1 parent e686037 commit 486cc2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions fileinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"
)

// FileInfo is just a wrapper around os.FileInfo which includes atime.
type FileInfo struct {
os.FileInfo
Atime time.Time
Expand Down
7 changes: 7 additions & 0 deletions haunter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,32 @@ import (
"time"
)

// Entry represents a cached item.
type Entry struct {
name string
inUse bool
}

// InUse returns if this Cache entry is in use.
func (e *Entry) InUse() bool {
return e.inUse
}

// Name returns the File.Name() of this entry.
func (e *Entry) Name() string {
return e.name
}

// CacheAccessor implementors provide ways to observe and interact with
// the cached entries, mainly used for cache-eviction.
type CacheAccessor interface {
FileSystemStater
EnumerateEntries(enumerator func(key string, e Entry) bool)
RemoveFile(key string)
}

// Haunter implementors are used to perform cache-eviction (Next is how long to wait
// until next evication, Haunt preforms the eviction).
type Haunter interface {
Haunt(c CacheAccessor)
Next() time.Duration
Expand Down

0 comments on commit 486cc2c

Please sign in to comment.