Wire in logic for selecting backing state impl

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
This commit is contained in:
Matthew Heon
2018-01-03 16:27:33 -05:00
committed by Atomic Bot
parent 5696dfef6e
commit b814a94c34
2 changed files with 32 additions and 9 deletions

View File

@ -81,15 +81,21 @@ func WithSignaturePolicy(path string) RuntimeOption {
}
}
// WithInMemoryState specifies that the runtime will be backed by an in-memory
// state only, and state will not persist after the runtime is shut down
func WithInMemoryState() RuntimeOption {
// WithStateType sets the backing state implementation for libpod
// Please note that information is not portable between backing states
// As such, if this differs between two libpods running on the same system,
// they will not share containers, and unspecified behavior may occur
func WithStateType(storeType RuntimeStateStore) RuntimeOption {
return func(rt *Runtime) error {
if rt.valid {
return ErrRuntimeFinalized
}
rt.config.InMemoryState = true
if storeType == InvalidStateStore {
return errors.Wrapf(ErrInvalidArg, "must provide a valid state store type")
}
rt.config.StateType = storeType
return nil
}