2022-06-25 09:54:42 +00:00
|
|
|
/*
|
|
|
|
Package container provides functionality related to the NeoFS containers.
|
|
|
|
|
|
|
|
The base type is Container. To create new container in the NeoFS network
|
|
|
|
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
|
|
|
|
|
|
|
After the container is persisted in the NeoFS network, applications can process
|
|
|
|
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
|
|
|
|
|
|
|
Instances can be also used to process NeoFS API V2 protocol messages
|
2022-12-13 14:36:35 +00:00
|
|
|
(see neo.fs.v2.container package in https://github.com/TrueCloudLab/frostfs-api).
|
2022-06-25 09:54:42 +00:00
|
|
|
|
|
|
|
On client side:
|
2022-08-24 14:17:40 +00:00
|
|
|
|
2022-12-13 14:36:35 +00:00
|
|
|
import "github.com/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
|