2022-06-25 09:54:42 +00:00
|
|
|
/*
|
2022-12-29 10:46:18 +00:00
|
|
|
Package container provides functionality related to the FrostFS containers.
|
2022-06-25 09:54:42 +00:00
|
|
|
|
2022-12-29 10:46:18 +00:00
|
|
|
The base type is Container. To create new container in the FrostFS network
|
2022-06-25 09:54:42 +00:00
|
|
|
Container instance should be initialized
|
|
|
|
|
2022-08-24 14:17:40 +00:00
|
|
|
var cnr Container
|
|
|
|
cnr.Init()
|
|
|
|
// fill all the fields
|
|
|
|
|
|
|
|
// encode cnr and send
|
2022-06-25 09:54:42 +00:00
|
|
|
|
2022-12-29 10:46:18 +00:00
|
|
|
After the container is persisted in the FrostFS network, applications can process
|
2022-06-25 09:54:42 +00:00
|
|
|
it using the instance of Container types
|
|
|
|
|
2022-08-24 14:17:40 +00:00
|
|
|
// recv binary container
|
|
|
|
|
|
|
|
var cnr Container
|
2022-06-25 09:54:42 +00:00
|
|
|
|
2022-08-24 14:17:40 +00:00
|
|
|
err := cnr.Unmarshal(bin)
|
|
|
|
// ...
|
2022-06-25 09:54:42 +00:00
|
|
|
|
2022-08-24 14:17:40 +00:00
|
|
|
// process the container data
|
2022-06-25 09:54:42 +00:00
|
|
|
|
2022-12-29 10:46:18 +00:00
|
|
|
Instances can be also used to process FrostFS API V2 protocol messages
|
2023-03-07 11:20:03 +00:00
|
|
|
(see neo.fs.v2.container package in https://git.frostfs.info/TrueCloudLab/frostfs-api).
|
2022-06-25 09:54:42 +00:00
|
|
|
|
|
|
|
On client side:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2023-03-07 11:20:03 +00:00
|
|
|
import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
|
2022-06-25 09:54:42 +00:00
|
|
|
|
|
|
|
var msg container.Container
|
|
|
|
cnr.WriteToV2(&msg)
|
|
|
|
|
|
|
|
// send msg
|
|
|
|
|
|
|
|
On server side:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2022-06-25 09:54:42 +00:00
|
|
|
// recv msg
|
|
|
|
|
|
|
|
var cnr Container
|
|
|
|
cnr.ReadFromV2(msg)
|
|
|
|
|
|
|
|
// process cnr
|
|
|
|
|
|
|
|
Using package types in an application is recommended to potentially work with
|
|
|
|
different protocol versions with which these types are compatible.
|
|
|
|
*/
|
|
|
|
package container
|