memory

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigNotFound       error = fmt.Errorf("config not found")
	ErrCycleDependentConfig error = fmt.Errorf("cycle in config dependency")
)

Functions

This section is empty.

Types

type RootConfigRepoMetadata added in v0.2.1

type RootConfigRepoMetadata struct {
	// This version refers to the version of the metadata.
	Version          string   `json:"version,omitempty" yaml:"version,omitempty"`
	Namespaces       []string `json:"namespaces,omitempty" yaml:"namespaces,omitempty"`
	ProtoDirectory   string   `json:"protoDir,omitempty" yaml:"protoDir,omitempty"`
	UseExternalTypes bool     `json:"externalTypes,omitempty" yaml:"externalTypes,omitempty"`
}

type SerializableTypes added in v0.5.1

type SerializableTypes struct {
	Types             *protoregistry.Types
	FileDescriptorSet *descriptorpb.FileDescriptorSet
}

func BuildDynamicTypeRegistryFromBufImage added in v0.5.1

func BuildDynamicTypeRegistryFromBufImage(image []byte) (*SerializableTypes, error)

func RegisterDynamicTypes added in v0.5.1

func RegisterDynamicTypes(files *protoregistry.Files) (*SerializableTypes, error)

func (*SerializableTypes) AddFileDescriptor added in v0.5.1

func (st *SerializableTypes) AddFileDescriptor(fd protoreflect.FileDescriptor, checkNotExists bool) error

type Store

type Store interface {
	Evaluate(key string, namespace string, lekkoContext map[string]interface{}, dest proto.Message) error
	EvaluateAny(key string, namespace string, lekkoContext map[string]interface{}) (protoreflect.ProtoMessage, error)
	Close(ctx context.Context) error
}

func NewBackendStore

func NewBackendStore(
	ctx context.Context,
	apiKey, url, ownerName, repoName string,
	client *http.Client,
	updateInterval time.Duration,
	serverPort int32,
	sdkVersion string,
) (Store, error)

Constructs an in-memory store that fetches configs from lekko's backend.

func NewGitStore added in v0.2.1

func NewGitStore(
	ctx context.Context,
	apiKey, url, ownerName, repoName, path string,
	client *http.Client,
	port int32,
	sdkVersion string,
) (Store, error)

Constructs an in-memory store that fetches configs from a local git repo at the given path. If api key is empty, the store runs in local (offline) mode, and does not communicate with Lekko.

func NewStaticStore added in v0.4.0

func NewStaticStore(featureBytes map[string]map[string][]byte) (Store, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL