Documentation ¶
Index ¶
- type Option
- type Options
- type Storage
- func (ts *Storage) BaseDir() string
- func (ts *Storage) Cleanup(_ context.Context) error
- func (ts *Storage) List(ctx context.Context, msg proto.Message) ([]string, error)
- func (ts *Storage) Load(ctx context.Context, msg nodeenrollment.MessageWithId) error
- func (ts *Storage) Remove(ctx context.Context, msg nodeenrollment.MessageWithId) error
- func (ts *Storage) Store(ctx context.Context, msg nodeenrollment.MessageWithId) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option is a function that takes in an options struct and sets values or returns an error
func WithBaseDirectory ¶
WithDirectory allows specifying a base directory to use
func WithSkipCleanup ¶
WithSkipCleanup causes FileStorage cleanup to be a no-op, useful for inspecting state after the fact
type Storage ¶
func New ¶
New creates a new object that implements the Storage interface in an on-disk directory. This is not currently explicitly thread-safe, although it may work without issue in that manner. Call Cleanup() when done with it.
Supported options: WithBaseDirectory, WithSkipCleanup
For safety, if a base directory is specified (that is, it's not a temporary directory generated by this function), cleanup is _always_ skipped.
func (*Storage) BaseDir ¶
Returns the base directory being used, useful for displaying in tests for after-test inspection
func (*Storage) Load ¶
func (ts *Storage) Load(ctx context.Context, msg nodeenrollment.MessageWithId) error
Load implements the Storage interface
func (*Storage) Remove ¶
func (ts *Storage) Remove(ctx context.Context, msg nodeenrollment.MessageWithId) error
Remove implements the Storage interface
func (*Storage) Store ¶
func (ts *Storage) Store(ctx context.Context, msg nodeenrollment.MessageWithId) error
Store implements the Storage interface.
If the message already exists, it is overwritten.