Documentation
¶
Overview ¶
Package statefile owns private atomic files and recoverable local commits.
Index ¶
- Constants
- func ReadSettings(ctx context.Context, path string) ([]byte, error)
- func Remove(path string) error
- func StateDirectory(path string) string
- func Transact(ctx context.Context, path string, action func(*Transaction) error) error
- func WithLock(ctx context.Context, path string, action func() error) error
- func Write(ctx context.Context, path string, data []byte) (err error)
- type Transaction
Constants ¶
const (
Settings = "settings"
)
Variables ¶
This section is empty.
Functions ¶
func ReadSettings ¶
ReadSettings needs no writable directory in the ordinary sharing path. A pending multi-file commit is recovered first; otherwise atomic replacement guarantees that a concurrent writer exposes either complete settings version.
func StateDirectory ¶
Types ¶
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction coordinates settings and operation records in one local namespace. Optional discovery caches do not participate in these commits.
func (*Transaction) Delete ¶
func (tx *Transaction) Delete(name string) error
func (*Transaction) Operations ¶
func (tx *Transaction) Operations() ([]string, error)
func (*Transaction) SettingsPath ¶
func (tx *Transaction) SettingsPath() string
SettingsPath lets configuration errors identify the same file held by the transaction.