Documentation
¶
Index ¶
- type DBSecretsManager
- func (s *DBSecretsManager) Delete(ctx context.Context, namespace, name string) error
- func (s *DBSecretsManager) Get(ctx context.Context, namespace, name string) (string, error)
- func (s *DBSecretsManager) List(ctx context.Context, namespace string) ([]string, error)
- func (s *DBSecretsManager) Set(ctx context.Context, namespace, name, value string) error
- type HostFunctions
- func (h *HostFunctions) CacheDelete(ctx context.Context, key string) error
- func (h *HostFunctions) CacheGet(ctx context.Context, key string) ([]byte, error)
- func (h *HostFunctions) CacheIncr(ctx context.Context, key string) (int64, error)
- func (h *HostFunctions) CacheIncrBy(ctx context.Context, key string, delta int64) (int64, error)
- func (h *HostFunctions) CacheSet(ctx context.Context, key string, value []byte, ttlSeconds int64) error
- func (h *HostFunctions) ClearContext()
- func (h *HostFunctions) DBExecute(ctx context.Context, query string, args []interface{}) (int64, error)
- func (h *HostFunctions) DBQuery(ctx context.Context, query string, args []interface{}) ([]byte, error)
- func (h *HostFunctions) EnqueueBackground(ctx context.Context, functionName string, payload []byte) (string, error)
- func (h *HostFunctions) GetCallerWallet(ctx context.Context) string
- func (h *HostFunctions) GetEnv(ctx context.Context, key string) (string, error)
- func (h *HostFunctions) GetLogs() []serverless.LogEntry
- func (h *HostFunctions) GetRequestID(ctx context.Context) string
- func (h *HostFunctions) GetSecret(ctx context.Context, name string) (string, error)
- func (h *HostFunctions) HTTPFetch(ctx context.Context, method, url string, headers map[string]string, ...) ([]byte, error)
- func (h *HostFunctions) LogError(ctx context.Context, message string)
- func (h *HostFunctions) LogInfo(ctx context.Context, message string)
- func (h *HostFunctions) PubSubPublish(ctx context.Context, topic string, data []byte) error
- func (h *HostFunctions) ScheduleOnce(ctx context.Context, functionName string, runAt time.Time, payload []byte) (string, error)
- func (h *HostFunctions) SetInvocationContext(invCtx *serverless.InvocationContext)
- func (h *HostFunctions) StorageGet(ctx context.Context, cid string) ([]byte, error)
- func (h *HostFunctions) StoragePut(ctx context.Context, data []byte) (string, error)
- func (h *HostFunctions) WSBroadcast(ctx context.Context, topic string, data []byte) error
- func (h *HostFunctions) WSSend(ctx context.Context, clientID string, data []byte) error
- type HostFunctionsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBSecretsManager ¶
type DBSecretsManager struct {
// contains filtered or unexported fields
}
DBSecretsManager implements SecretsManager using the database.
func NewDBSecretsManager ¶
func NewDBSecretsManager(db rqlite.Client, encryptionKeyHex string, logger *zap.Logger) (*DBSecretsManager, error)
NewDBSecretsManager creates a secrets manager backed by the database.
func (*DBSecretsManager) Delete ¶
func (s *DBSecretsManager) Delete(ctx context.Context, namespace, name string) error
Delete removes a secret.
type HostFunctions ¶
type HostFunctions struct {
// contains filtered or unexported fields
}
HostFunctions provides the bridge between WASM functions and Orama services. It implements the HostServices interface and is injected into the execution context.
func NewHostFunctions ¶
func NewHostFunctions( db rqlite.Client, cacheClient olriclib.Client, storage ipfs.IPFSClient, pubsubAdapter *pubsub.ClientAdapter, wsManager serverless.WebSocketManager, secrets serverless.SecretsManager, cfg HostFunctionsConfig, logger *zap.Logger, ) *HostFunctions
NewHostFunctions creates a new HostFunctions instance.
func (*HostFunctions) CacheDelete ¶
func (h *HostFunctions) CacheDelete(ctx context.Context, key string) error
CacheDelete removes a value from the cache.
func (*HostFunctions) CacheIncr ¶
CacheIncr atomically increments a numeric value in cache by 1 and returns the new value. If the key doesn't exist, it is initialized to 0 before incrementing. Returns an error if the value exists but is not numeric.
func (*HostFunctions) CacheIncrBy ¶
CacheIncrBy atomically increments a numeric value by delta and returns the new value. If the key doesn't exist, it is initialized to 0 before incrementing. Returns an error if the value exists but is not numeric.
func (*HostFunctions) CacheSet ¶
func (h *HostFunctions) CacheSet(ctx context.Context, key string, value []byte, ttlSeconds int64) error
CacheSet stores a value in the cache with optional TTL. Note: TTL is currently not supported by the underlying Olric DMap.Put method. Values are stored indefinitely until explicitly deleted.
func (*HostFunctions) ClearContext ¶
func (h *HostFunctions) ClearContext()
ClearContext clears the invocation context after execution.
func (*HostFunctions) DBExecute ¶
func (h *HostFunctions) DBExecute(ctx context.Context, query string, args []interface{}) (int64, error)
DBExecute executes an INSERT/UPDATE/DELETE query and returns affected rows.
func (*HostFunctions) DBQuery ¶
func (h *HostFunctions) DBQuery(ctx context.Context, query string, args []interface{}) ([]byte, error)
DBQuery executes a SELECT query and returns JSON-encoded results.
func (*HostFunctions) EnqueueBackground ¶
func (h *HostFunctions) EnqueueBackground(ctx context.Context, functionName string, payload []byte) (string, error)
EnqueueBackground queues a function for background execution.
func (*HostFunctions) GetCallerWallet ¶
func (h *HostFunctions) GetCallerWallet(ctx context.Context) string
GetCallerWallet returns the wallet address of the caller.
func (*HostFunctions) GetLogs ¶
func (h *HostFunctions) GetLogs() []serverless.LogEntry
GetLogs returns the captured logs for the current invocation.
func (*HostFunctions) GetRequestID ¶
func (h *HostFunctions) GetRequestID(ctx context.Context) string
GetRequestID returns the current request ID.
func (*HostFunctions) HTTPFetch ¶
func (h *HostFunctions) HTTPFetch(ctx context.Context, method, url string, headers map[string]string, body []byte) ([]byte, error)
HTTPFetch makes an outbound HTTP request.
func (*HostFunctions) LogError ¶
func (h *HostFunctions) LogError(ctx context.Context, message string)
LogError logs an error message.
func (*HostFunctions) LogInfo ¶
func (h *HostFunctions) LogInfo(ctx context.Context, message string)
LogInfo logs an info message.
func (*HostFunctions) PubSubPublish ¶
PubSubPublish publishes a message to a topic.
func (*HostFunctions) ScheduleOnce ¶
func (h *HostFunctions) ScheduleOnce(ctx context.Context, functionName string, runAt time.Time, payload []byte) (string, error)
ScheduleOnce schedules a function to run once at a specific time.
func (*HostFunctions) SetInvocationContext ¶
func (h *HostFunctions) SetInvocationContext(invCtx *serverless.InvocationContext)
SetInvocationContext sets the current invocation context. Must be called before executing a function.
func (*HostFunctions) StorageGet ¶
StorageGet retrieves data from IPFS by CID.
func (*HostFunctions) StoragePut ¶
StoragePut uploads data to IPFS and returns the CID.
func (*HostFunctions) WSBroadcast ¶
WSBroadcast sends data to all WebSocket clients subscribed to a topic.
type HostFunctionsConfig ¶
HostFunctionsConfig holds configuration for HostFunctions.