Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var WithLogger = func(l *zap.Logger) OOSMOption { return func(s *oosmService) error { s.logger = l return nil } }
WithLogger set the given logger.
var WithRootDatastore = func(ds ds.Datastore) OOSMOption { return func(s *oosmService) error { s.rootDatastore = ds return nil } }
WithRootDatastore set the root datastore.
var WithSecretStore = func(ss secretstore.SecretStore) OOSMOption { return func(s *oosmService) error { s.secretStore = ss return nil } }
WithSecretStore set the secret store.
Functions ¶
This section is empty.
Types ¶
type FallBackOption ¶
type FallBackOption struct {
// contains filtered or unexported fields
}
FallBackOption is a structure that permit to fallback to a default option if the option is not set.
type OOSMOption ¶
type OOSMOption func(*oosmService) error
var WithDefaultLogger OOSMOption = func(s *oosmService) error { s.logger = zap.NewNop() return nil }
WithDefaultLogger init a noop logger.
var WithDefaultRootDatastore OOSMOption = func(s *oosmService) error { s.rootDatastore = ds_sync.MutexWrap(ds.NewMapDatastore()) return nil }
WithDefaultRootDatastore init a in-memory datastore.
var WithDefaultSecretStore OOSMOption = func(s *oosmService) error { if err := WithFallbackRootDatastore(s); err != nil { return err } if err := WithFallbackLogger(s); err != nil { return err } var err error s.secretStore, err = secretstore.NewSecretStore(s.rootDatastore, &secretstore.NewSecretStoreOptions{ Logger: s.logger, }) return err }
WithDefaultSecretStore init a new secret store. Call WithRootDatastore before this option if you want to use your datastore. Call WithLogger before this option if you want to use your logger.
var WithFallbackDefaults OOSMOption = func(s *oosmService) error { for _, def := range defaults { if !def.fallback(s) { continue } if err := def.opt(s); err != nil { return err } } return nil }
WithFallbackDefaults set the default options if no option is set.
var WithFallbackLogger OOSMOption = func(s *oosmService) error { if fallbackLogger.fallback(s) { return fallbackLogger.opt(s) } return nil }
WithFallbackLogger set the logger if no logger is set.
var WithFallbackRootDatastore OOSMOption = func(s *oosmService) error { if fallbackRootDatastore.fallback(s) { return fallbackRootDatastore.opt(s) } return nil }
WithFallbackRootDatastore set the root datastore if no root datastore is set.
var WithFallbackSecretStore OOSMOption = func(s *oosmService) error { if fallbackSecretStore.fallback(s) { return fallbackSecretStore.opt(s) } return nil }
WithFallbackSecretStore set the secret store if no secret store is set. Call WithRootDatastore before this option if you want to use your datastore if a new secret store is created. Call WithLogger before this option if you want to use your logger if a new secret store is created.
type OOSMService ¶
type OOSMService interface {
outofstoremessagetypes.OutOfStoreMessageServiceServer
}
func NewOutOfStoreMessageService ¶
func NewOutOfStoreMessageService(opts ...OOSMOption) (OOSMService, error)
type OOSMServiceClient ¶
type OOSMServiceClient interface {
outofstoremessagetypes.OutOfStoreMessageServiceClient
io.Closer
}
func NewOutOfStoreMessageServiceClient ¶
func NewOutOfStoreMessageServiceClient(opts ...OOSMOption) (OOSMServiceClient, error)
NewOutOfStoreMessageServiceClient creates a new Wesh protocol service and returns a gRPC ServiceClient which uses a direct in-memory connection. When finished, you must call Close(). This opens or creates a Wesh account where the datastore location is specified by the path argument. The service will not start any network stuff, it will only use the filesystem to store or get data.