Documentation
¶
Overview ¶
Package aether provides a MemoryLayer SDK memorylayer.Transport that routes every request through an existing Aether SDK connection via proxy_http, instead of opening a direct HTTP path to the MemoryLayer server.
It is a separate Go module so that HTTP-only callers of the core github.com/scitrera/memorylayer/memorylayer-sdk-go package do not pull in the Aether SDK's gRPC dependency tree.
Usage ¶
agentClient, _ := aethersdk.NewAgentClient(aethersdk.AgentOptions{ /* ... */ })
// ... agentClient.Connect(ctx) ...
tr := aether.NewTransport(agentClient, aether.WithTarget("sv::memorylayer"))
client, _ := memorylayer.NewClient(
memorylayer.WithTransport(tr),
memorylayer.WithAPIKey("..."),
memorylayer.WithWorkspaceID("ws_123"),
)
The transport does NOT own the Aether connection: Transport.Close is a no-op, and disposing of the underlying client is the caller's responsibility.
Index ¶
Constants ¶
const DefaultTarget = "sv::memorylayer"
DefaultTarget is the Aether service topic used when none is configured. The bare form lets Aether route to an available memorylayer service instance.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Transport)
Option configures a Transport.
func WithBackend ¶
WithBackend pins requests to a named terminator backend (its allow-list still applies).
func WithBasePath ¶
WithBasePath overrides the API version path the SDK is mounted under (default "/v1"), matching the terminator's allow_paths.
func WithTarget ¶
WithTarget sets the Aether service topic (default DefaultTarget). Use an explicit "sv::memorylayer::<specifier>" to pin a specific instance.
func WithTimeout ¶
WithTimeout sets a per-request timeout, applied as a context deadline when the caller's context has none (default 30s).
type ProxyClient ¶
type ProxyClient interface {
ProxyHTTP(ctx context.Context, target string, req *http.Request, opts ...aethersdk.ProxyOpt) (*http.Response, error)
}
ProxyClient is the subset of the Aether SDK client the transport needs. Both *aethersdk.AgentClient and *aethersdk.ServiceClient satisfy it (each embeds *aethersdk.BaseClient, which provides ProxyHTTP).
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements memorylayer.Transport over an Aether connection.
func NewTransport ¶
func NewTransport(client ProxyClient, opts ...Option) *Transport
NewTransport builds an Aether transport over an already-connected Aether client (an *aethersdk.AgentClient or *aethersdk.ServiceClient).
func (*Transport) RoundTrip ¶
func (t *Transport) RoundTrip(ctx context.Context, req *memorylayer.Request) (*memorylayer.Response, error)
RoundTrip implements memorylayer.Transport.
Directories
¶
| Path | Synopsis |
|---|---|
|
Command example wires the MemoryLayer Go SDK onto an Aether connection: every request is tunneled through the Aether gateway via proxy_http to the MemoryLayer service topic, instead of a direct HTTP call.
|
Command example wires the MemoryLayer Go SDK onto an Aether connection: every request is tunneled through the Aether gateway via proxy_http to the MemoryLayer service topic, instead of a direct HTTP call. |