Documentation
¶
Overview ¶
Package accessor owns a reusable native storage-options accessor and the dynamic Go provider behind it.
The native accessor caches, expires and refreshes options. Go callbacks only translate one fetch request; they do not run a refresh loop or keep a second credential cache. The root lance package declares the public wrapper types and forwards to this package; sibling packages resolve that private state through From without adding a public bridge method.
Index ¶
- func Acquire(a *Accessor) (*ffi.StorageOptionsAccessor, func(), bool)
- type Accessor
- func From(owner any) (*Accessor, bool)
- func New(initial map[string]string, provider Provider, ...) (*Accessor, error)
- func NewFromProvider(provider *ffi.StorageOptionsProvider, ...) (*Accessor, error)
- func NewStatic(values map[string]string, wrapError func(op, uri string, err error) error) (*Accessor, error)
- func NewStaticPresence(initial map[string]string, hasInitial bool, ...) (*Accessor, error)
- type ForceProvider
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Accessor ¶
type Accessor struct {
// contains filtered or unexported fields
}
Accessor is a reusable, owned native storage-options accessor. It may be shared by datasets, file readers, file writers and file sessions. Close waits for local snapshots and native calls that acquired it, but not for native datasets or stores that retained their own reference.
func From ¶ added in v0.2.0
From returns the implementation behind owner. It reports false when owner is not a public root StorageOptionsAccessor wrapper.
func New ¶
func New(initial map[string]string, provider Provider, wrapError func(op, uri string, err error) error) (*Accessor, error)
New uses the caller error conversion for Snapshot, preserving public error identities without exposing the FFI error type. It creates an accessor from optional initial options and an optional provider. A nil initial map means native None; a non-nil map, including an empty one, means Some(initial). With neither initial options nor a provider the accessor is native None.
func NewFromProvider ¶
func NewFromProvider(provider *ffi.StorageOptionsProvider, wrapError func(op, uri string, err error) error) (*Accessor, error)
NewFromProvider adopts a provider created by native namespace bindings. The temporary provider handle is closed after the accessor retains its native Arc. Initial options are not accepted here; the namespace provider supplies them from its own describe-table response.
func NewStatic ¶
func NewStatic(values map[string]string, wrapError func(op, uri string, err error) error) (*Accessor, error)
NewStatic creates a static accessor. A nil or empty map means Some(empty), matching the historical file StorageOptions behavior; use a nil accessor for native None.
func NewStaticPresence ¶
func NewStaticPresence(initial map[string]string, hasInitial bool, wrapError func(op, uri string, err error) error) (*Accessor, error)
NewStaticPresence creates a static accessor with explicit nil/empty presence. A nil initial map with hasInitial false means native None.
func (*Accessor) Close ¶
func (a *Accessor) Close()
Close releases the caller's accessor handle and waits for in-flight local acquisitions. Native datasets and stores retain their own references, so they do not block Close and remain usable afterwards.
func (*Accessor) ProviderID ¶
ProviderID returns the native identity of the provider, or an empty string for a purely static accessor.
func (*Accessor) Snapshot ¶
Snapshot returns the currently resolved options. A nil map with hasOptions false means native None; a non-nil empty map with true means Some(empty). The map is an independent copy and may be mutated by the caller. Native wraps provider fetch failures as IO errors while retaining their messages.
type ForceProvider ¶
type ForceProvider interface {
ForceFetchStorageOptions(ctx context.Context) (map[string]string, error)
}
ForceProvider optionally distinguishes an explicit force refresh from a normal fetch. Native falls back to Provider.FetchStorageOptions when this interface is not implemented.
type Provider ¶
type Provider interface {
StorageOptionsProviderID() string
FetchStorageOptions(ctx context.Context) (map[string]string, error)
}
Provider supplies dynamic storage options.
StorageOptionsProviderID identifies the provider to native code. Providers with the same ID share native equality and object-store registry identity; the ID is security-scoped, so different credential scopes must use different IDs. FetchStorageOptions returns nil for native None and a non-nil empty map for an explicitly empty option set. The context is valid only for the callback and is currently background-scoped; native refresh policy owns expiration and call timing. Implementations must be safe for concurrent calls from native worker threads.