Documentation ¶
Index ¶
- func CheckAndSplitMetadata(ctx context.Context, nd ipld.Node, ds ipld.DAGService, meta bool) (ipld.Node, ipld.Node, error)
- func CreateMetadataList(metaBytes []byte, dirTreeBytes []byte) []byte
- func EqualKeySets(m map[string]interface{}, inputKeys []string) bool
- func GetMetadataElement(bytes []byte) []byte
- func GetMetadataList(bytes []byte) ([]byte, []byte, error)
- func GetSerializedDirectoryElement(bytes []byte) []byte
- func Intersects(m map[string]interface{}, inputM map[string]interface{}) bool
- func IsMetadataEmpty(b []byte) bool
- func KeyIntersects(m map[string]interface{}, inputKeys []string) bool
- func ReadMetadataElementFromDag(ctx context.Context, root ipld.Node, ds ipld.DAGService, meta bool) ([]byte, error)
- func ReadMetadataListFromDag(ctx context.Context, root ipld.Node, ds ipld.DAGService, meta bool) ([]byte, []byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAndSplitMetadata ¶ added in v0.5.2
func CheckAndSplitMetadata(ctx context.Context, nd ipld.Node, ds ipld.DAGService, meta bool) (ipld.Node, ipld.Node, error)
checkAndSplitMetadata returns both data root node and metadata root node if exists from the DAG topped by the given 'nd'. Case #1: if 'nd' is dummy root with metadata root node and user data root node being children,
return [the second data root child node, the first metadata root child node, nil].
Case #2: if 'nd' is metadata and the given `meta` is true, return [nil, nd, nil]. Otherwise return error. Case #3: if 'nd' is user data, return ['nd', nil, nil].
func CreateMetadataList ¶ added in v0.5.2
CreateMetadataList join the given two byte array element into a final list format as BTFS metadata.
- Append the above `dirTreeBytes` byte array to metaBytes so that the final encoded output can ebable strings.SplitAfterN(encodedOutput, "},{", 2) to have two strings, to be processed separately with json.Unmarshal().
- Ensure metaBytes has two sections, each enclosed within curly bracket pair. E.g., `{"price":11.0},{}`. This will make the encoder task easy.
The precondition is to pass nil to `metaBytes` if no value exist for regular metadata, nil to `dirTreeBytes` for directoy tree bytes in case of Reed-Solomon directory inpuyt,
func EqualKeySets ¶
EqualKeySets returns true if the key set of the given `m` equals the given key string array `inputKeys`.
func GetMetadataElement ¶ added in v0.5.2
func GetMetadataList ¶ added in v0.5.2
GetMetadataSList splits the given encoded metadata `bytes` into two byte arrays in JSON format. Note that chunker.RsMetaMap.IsDir indicates or true when the second array has contents.
func GetSerializedDirectoryElement ¶ added in v0.5.2
func Intersects ¶
Intersects returns true if the given two maps intersect.
func IsMetadataEmpty ¶ added in v0.5.2
func KeyIntersects ¶
KeyIntersects returns true if the key set of the given `m` and the string array `inputKeys` intersects.
func ReadMetadataElementFromDag ¶ added in v0.5.2
Types ¶
This section is empty.