package file
import "github.com/open-policy-agent/opa/internal/wasm/sdk/opa/loader/file"
Index ¶
- Constants
- type Loader
- func New(opa *opa.OPA) *Loader
- func (l *Loader) Close()
- func (l *Loader) Init() (*Loader, error)
- func (l *Loader) Load(ctx context.Context) error
- func (l *Loader) Start(ctx context.Context) error
- func (l *Loader) WithErrorLogger(logger func(error)) *Loader
- func (l *Loader) WithFile(filename string) *Loader
- func (l *Loader) WithInterval(interval time.Duration) *Loader
Constants ¶
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads a bundle from a file. If started, it loads the bundle periodically until closed.
func New ¶
New constructs a new file loader periodically reloading the bundle from a file.
func (*Loader) Close ¶
func (l *Loader) Close()
Close stops the loading, releasing all resources.
func (*Loader) Init ¶
Init initializes the loader after its construction and configuration. If invalid config, will return ErrInvalidConfig.
func (*Loader) Load ¶
Load loads the bundle from a file and installs it. The possible returned errors are ErrInvalidBundle (in case of an error in loading or opening the bundle) and the ones SetPolicyData of OPA returns.
func (*Loader) Start ¶
Start starts the periodic loading byt calling Load, failing if the bundle loading fails.
func (*Loader) WithErrorLogger ¶
WithErrorLogger configures an error logger invoked with all the errors.
func (*Loader) WithFile ¶
WithFile configures the file to load the bundle from.
func (*Loader) WithInterval ¶
WithInterval configures the delay between bundle file reloading.
Source Files ¶
- Version
- v0.46.0
- Published
- Nov 3, 2022
- Platform
- js/wasm
- Imports
- 7 packages
- Last checked
- 20 minutes ago –
Tools for package owners.