client

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvroRecord

type AvroRecord interface {
	Schema() avro.Schema
}

AvroRecord is an interface that provides the Avro schema.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the main entry point for the FigChain client.

func New

func New(opts ...config.Option) (*Client, error)

New creates a new Client.

func NewClientFromConfig added in v0.2.1

func NewClientFromConfig(path string, opts ...config.Option) (*Client, error)

NewClientFromConfig creates a new Client from a JSON configuration file. Prioritizes Env vars over Config file, but Options over everything.

func (*Client) Close

func (c *Client) Close() error

Close closes the client and releases resources.

func (*Client) GetFig

func (c *Client) GetFig(key string, target any, ctx *evaluation.EvaluationContext) error

GetFig retrieves a configuration and deserializes it into target.

func (*Client) GetFigRaw added in v0.2.2

func (c *Client) GetFigRaw(key string, ctx *evaluation.EvaluationContext) ([]byte, error)

GetFigRaw retrieves the raw (decrypted if necessary) payload for a specific key. This allows the caller to handle deserialization (e.g. using generated code directly).

func (*Client) RegisterListener added in v0.1.1

func (c *Client) RegisterListener(key string, prototype AvroRecord, callback func(AvroRecord))

RegisterListener registers a callback for updates to a specific key. The callback is invoked with the deserialized object when an update occurs.

IMPORTANT: This feature should be used for SERVER-SCOPED configuration only (e.g. global flags). The update is evaluated with an empty context. If your rules depend on user-specific attributes (like request-scoped context), this listener may receive default values or fail to match rules. For request-scoped configuration, use GetFig() with the appropriate context when needed.

func (*Client) RegisterRawListener added in v0.2.2

func (c *Client) RegisterRawListener(key string, callback func(string, []byte))

RegisterRawListener registers a callback for updates to a specific key, returning the raw payload. This allows the caller to handle deserialization.

IMPORTANT: This feature should be used for SERVER-SCOPED configuration only (e.g. global flags). The update is evaluated with an empty context. If your rules depend on user-specific attributes (like request-scoped context), this listener may receive default values or fail to match rules. For request-scoped configuration, use GetFig() with the appropriate context when needed.

func (*Client) Watch

func (c *Client) Watch(ctx context.Context, key string) <-chan model.FigFamily

Watch returns a channel that receives updates for a specific key.

Jump to

Keyboard shortcuts

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