Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoHashFound = errors.New("no hash found")
var ErrNoLoaderSupplied = errors.New("no remoteLoader supplied")
var ErrPersistedOperationNotFound = errors.New("PersistedOperationNotFound")
var ErrPersistedQueryNotFound = errors.New("PersistedQueryNotFound")
var ErrReloadIntervalTooShort = errors.New("load interval cannot be less than 10 seconds")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Enabled bool `yaml:"enabled"` RejectOnFailure bool `yaml:"reject_on_failure"` Loader LoaderConfig `yaml:"loader"` }
func DefaultConfig ¶
func DefaultConfig() Config
type ErrorMessage ¶
type ErrorMessage struct {
Message string `json:"message"`
}
type ErrorPayload ¶
type GcpLoader ¶
type GcpLoader struct {
// contains filtered or unexported fields
}
GcpStorageLoader loads persisted operations from a GCP Storage bucket. It matches files based on a `*.json` glob pattern and attempts to unmarshall them into a persisted operations map structure
func NewGcpLoader ¶
func NewGcpLoader(cfg LoaderConfig, log *slog.Logger) (*GcpLoader, error)
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewPersistedOperations ¶
func (*Handler) SwapHashForQuery ¶
SwapHashForQuery runs of the persisted operations handler it uses the configuration supplied to decide its behavior
type Loader ¶
type LoaderConfig ¶
type LocalLoader ¶
type LocalLoader struct {
// contains filtered or unexported fields
}
LocalLoader loads persisted operations from a filesystem directory It looks at all files in the directory, but doesn't traverse subdirectories If it finds a file with a `.json` extension it attempts to unmarshall it and use it as a source for persisted operations/ If it fails to load a file it moves on to the next file in the directory
func NewLocalDirLoader ¶
func NewLocalDirLoader(cfg Config, log *slog.Logger) *LocalLoader
func (*LocalLoader) Load ¶
func (d *LocalLoader) Load(_ context.Context) (map[string]PersistedOperation, error)
func (*LocalLoader) Type ¶
func (d *LocalLoader) Type() string
type MemoryLoader ¶
type MemoryLoader struct {
Store map[string]PersistedOperation
}
MemoryLoader is a loader for testing purposes It allows the user to specify operations in memory
func (*MemoryLoader) Load ¶
func (d *MemoryLoader) Load(_ context.Context) (map[string]PersistedOperation, error)
func (*MemoryLoader) Type ¶
func (d *MemoryLoader) Type() string
type NoOpLoader ¶
type NoOpLoader struct { }
func NewNoOpLoader ¶
func NewNoOpLoader() (*NoOpLoader, error)
func (*NoOpLoader) Load ¶
func (n *NoOpLoader) Load(_ context.Context) (map[string]PersistedOperation, error)
func (*NoOpLoader) Type ¶
func (n *NoOpLoader) Type() string
type PersistedOperation ¶
type ReloadFailureStrategy ¶
type ReloadFailureStrategy string
var ReloadFailureStrategyIgnore ReloadFailureStrategy = "ignore-failure"
var ReloadFailureStrategyReject ReloadFailureStrategy = "reject-on-failure"