requestargs

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0, BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package requestargs implements special encoding of the dict.Dict which allows optimized transfer of big data through SC request. It encodes big data chunks as hashes, which later can be decoded (solidified) into the original form treating the hashes as content addresses on IPFS and other mediums well suited for dalivery of big data chunks to wasm nodes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestArgs

type RequestArgs dict.Dict

RequestArgs encodes request parameters taking into account hashes of data blobs

func FromMarshalUtil

func FromMarshalUtil(mu *marshalutil.MarshalUtil) (RequestArgs, error)

func New

func New(d ...dict.Dict) RequestArgs

New makes new object taking 'as is', without encoding

func NewOptimizedRequestArgs

func NewOptimizedRequestArgs(d dict.Dict, optSize ...int) (RequestArgs, map[kv.Key][]byte)

NewOptimizedRequestArgs takes dictionary and encodes it

func (RequestArgs) AddAsBlobRef

func (a RequestArgs) AddAsBlobRef(name kv.Key, data []byte) hashing.HashValue

AddAsBlobRef adds argument with the data hash instead of data itself. Encodes key as "blob reference"

func (RequestArgs) AddEncodeBlobRef

func (a RequestArgs) AddEncodeBlobRef(name kv.Key, hash hashing.HashValue) RequestArgs

AddEncodeBlobRef adds hash as data and marks it is a blob reference

func (RequestArgs) AddEncodeSimple

func (a RequestArgs) AddEncodeSimple(name kv.Key, data []byte) RequestArgs

AddEncodeSimple add new ordinary argument. Encodes the key as "normal"

func (RequestArgs) AddEncodeSimpleMany

func (a RequestArgs) AddEncodeSimpleMany(d dict.Dict) RequestArgs

func (RequestArgs) Bytes

func (a RequestArgs) Bytes() []byte

func (RequestArgs) Clone

func (a RequestArgs) Clone() RequestArgs

func (RequestArgs) ReadFromMarshalUtil

func (a RequestArgs) ReadFromMarshalUtil(mu *marshalutil.MarshalUtil) error

func (RequestArgs) SolidifyRequestArguments

func (a RequestArgs) SolidifyRequestArguments(reg registry.BlobCache, downloaderOpt ...*downloader.Downloader) (dict.Dict, bool, error)

SolidifyRequestArguments decodes RequestArgs. each key-value pair ir treated according to the first byte of the key:

  • if the key starts with '*' the value is a content reference. First 32 bytes of the value are always treated as data hash. The rest (if any) is a content address. It will be treated by a downloader
  • otherwise, value is treated a raw data and the first byte of the key is ignored

func (RequestArgs) String

func (a RequestArgs) String() string

func (RequestArgs) WriteToMarshalUtil

func (a RequestArgs) WriteToMarshalUtil(mu *marshalutil.MarshalUtil)

Jump to

Keyboard shortcuts

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