2020-07-24 13:54:03 +00:00
|
|
|
package container
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
// PutArgs groups the arguments
|
|
|
|
// of put container invocation call.
|
|
|
|
type PutArgs struct {
|
|
|
|
cnr []byte // container in a binary format
|
|
|
|
|
|
|
|
sig []byte // binary container signature
|
2020-09-02 16:25:46 +00:00
|
|
|
|
|
|
|
publicKey []byte // public key of container owner
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|
|
|
|
|
2020-09-02 16:25:46 +00:00
|
|
|
// SetPublicKey sets the public key of container owner
|
2020-07-24 13:54:03 +00:00
|
|
|
// in a binary format.
|
2020-09-02 16:25:46 +00:00
|
|
|
func (p *PutArgs) SetPublicKey(v []byte) {
|
|
|
|
p.publicKey = v
|
2020-07-24 13:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetContainer sets the container structure
|
|
|
|
// in a binary format.
|
|
|
|
func (p *PutArgs) SetContainer(v []byte) {
|
|
|
|
p.cnr = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSignature sets the container structure
|
|
|
|
// owner's signature.
|
|
|
|
func (p *PutArgs) SetSignature(v []byte) {
|
|
|
|
p.sig = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put invokes the call of put container method
|
|
|
|
// of NeoFS Container contract.
|
|
|
|
func (c *Client) Put(args PutArgs) error {
|
|
|
|
return errors.Wrapf(c.client.Invoke(
|
|
|
|
c.putMethod,
|
|
|
|
args.cnr,
|
|
|
|
args.sig,
|
2020-09-02 16:25:46 +00:00
|
|
|
args.publicKey,
|
2020-07-24 13:54:03 +00:00
|
|
|
), "could not invoke method (%s)", c.putMethod)
|
|
|
|
}
|