Documentation
¶
Index ¶
- func LoadStateFromFile(filePath string, rateCache, botCache, verifiedCache *lru.Cache) error
- func ReconcileState(fileState State, rateCache, botCache, verifiedCache *lru.Cache)
- func SaveStateToFile(filePath string, reconcile bool, rateCache, botCache, verifiedCache *lru.Cache, ...) (lockMs, readMs, reconcileMs, marshalMs, writeMs, totalMs int64, err error)
- func SetState(state State, rateCache, botCache, verifiedCache *lru.Cache)
- type CacheEntry
- type FileLock
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadStateFromFile ¶ added in v1.10.0
LoadStateFromFile loads state from a file with locking.
func ReconcileState ¶ added in v1.10.0
ReconcileState merges file-based state with in-memory state.
func SaveStateToFile ¶ added in v1.10.0
func SaveStateToFile( filePath string, reconcile bool, rateCache, botCache, verifiedCache *lru.Cache, log *slog.Logger, ) (lockMs, readMs, reconcileMs, marshalMs, writeMs, totalMs int64, err error)
SaveStateToFile saves state to a file with locking and optional reconciliation. When reconcile is true, it reads and merges existing file state before saving. Returns timing metrics for debugging.
Types ¶
type CacheEntry ¶ added in v1.10.0
type CacheEntry struct {
Value interface{} `json:"value"`
Expiration int64 `json:"expiration"` // Unix timestamp in nanoseconds, 0 means no expiration
}
CacheEntry represents a cache item with its expiration time
type FileLock ¶ added in v1.10.0
type FileLock struct {
// contains filtered or unexported fields
}
FileLock represents an exclusive file lock using lock file creation This implementation doesn't use syscall.Flock which is not available in Traefik plugins
func NewFileLock ¶ added in v1.10.0
NewFileLock creates a new file lock for the given path. It uses a separate .lock file to coordinate access.
func (*FileLock) Close ¶ added in v1.10.0
Close is an alias for Unlock for compatibility. It will not return an error if the lock is held by another process.