Documentation ¶
Index ¶
- func DelCache(ctx context.Context, keyStr string) bool
- func GetCache(ctx context.Context, keyStr string) ([]byte, error)
- func InitResolverCache(node *masa.OracleNode, keyManager *masacrypto.KeyManager)
- func PutCache(ctx context.Context, keyStr string, value []byte) (any, error)
- func ReadData(node *masa.OracleNode, key string) ([]byte, error)
- func SendToS3(uid string, payload map[string]string) error
- func UpdateCache(ctx context.Context, keyStr string, newValue []byte) (bool, error)
- func Verifier(h host.Host, data []byte, signature []byte) bool
- func WriteData(node *masa.OracleNode, key string, value []byte) error
- type AuthorizedNodes
- type Record
- type SharedData
- type WorkEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelCache ¶
DelCache deletes a key-value pair from the resolver cache. It takes a context and a key string, converts the key into a datastore key, and deletes the key-value pair from the cache. It returns a bool indicating if the deletion succeeded.
func GetCache ¶
GetCache retrieves a value from the resolver cache for the given key. It takes a context and a key string, converts the key into a datastore key, gets the value from the cache, and returns the value byte slice and a possible error.
func InitResolverCache ¶
func InitResolverCache(node *masa.OracleNode, keyManager *masacrypto.KeyManager)
InitResolverCache initializes the resolver cache for the Masa Oracle node.
Parameters:
- node: A pointer to the Masa Oracle node (masa.OracleNode) that the resolver cache will be associated with.
- keyManager: A pointer to the key manager (masacrypto.KeyManager) used for cryptographic operations.
This function sets up the resolver cache for the Masa Oracle node. The resolver cache is responsible for storing and managing resolved data within the node.
The function takes two parameters:
- `node`: It represents the Masa Oracle node instance to which the resolver cache will be attached. The node provides the necessary context and dependencies for the resolver cache to operate.
- `keyManager`: It is an instance of the key manager that handles cryptographic operations. The key manager is used by the resolver cache for any required cryptographic tasks, such as signing or verifying data.
The purpose of this function is to initialize the resolver cache and perform any necessary setup or configuration. It associates the resolver cache with the provided Masa Oracle node and key manager.
Note: The specific implementation details of the `InitResolverCache` function are not provided in the given code snippet. The function signature suggests that it initializes the resolver cache, but the actual initialization logic would be present in the function body.
func PutCache ¶
PutCache puts a key-value pair into the resolver cache.
It takes a context, a key as a string, and a value as a byte slice. It converts the key into a datastore key and puts the key-value pair into the cache.
It returns the original key string and a possible error.
func ReadData ¶
func ReadData(node *masa.OracleNode, key string) ([]byte, error)
ReadData reads the value for the given key from the database. It requires the host for access control verification before reading.
func SendToS3 ¶
SendToS3 sends a payload to an S3-compatible API.
@param {string} uid - The unique identifier for the payload. @param {map[string]string} payload - The payload to be sent, represented as a map of key-value pairs. @returns {error} - Returns an error if the operation fails, otherwise returns nil.
func UpdateCache ¶
UpdateCache updates the value for the given key in the resolver cache. It first checks if the key already exists using Has(). If it doesn't exist, it returns an error. If the key does exist, it puts the new value into the cache using Put(). It returns a bool indicating if the update succeeded, and a possible error.
Types ¶
type AuthorizedNodes ¶
AuthorizedNodes Set of authorized nodes that can write to the database
type Record ¶
type SharedData ¶
type SharedData map[string]interface{}
SharedData is a map that stores shared data across the application.