forked from TrueCloudLab/frostfs-node
[#907] container/put: Work with named containers
Add name and zone arguments to `Put` method of wrapper over the Container contract client. Pass result of `container.GetNativeNameWithZone` function to the method in `Put` helper function. Due to this, the storage node will call the method depending on the presence of the container name in the attributes. Make IR to listen `putNamed` notification event. The event is processed like `put` event, but with sanity check of the container attributes. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
7db47c88bf
commit
e0f0188466
6 changed files with 80 additions and 15 deletions
|
@ -41,7 +41,9 @@ func Put(w *Wrapper, cnr *container.Container) (*cid.ID, error) {
|
|||
|
||||
sig := cnr.Signature()
|
||||
|
||||
err = w.Put(data, sig.Key(), sig.Sign(), binToken)
|
||||
name, zone := container.GetNativeNameWithZone(cnr)
|
||||
|
||||
err = w.Put(data, sig.Key(), sig.Sign(), binToken, name, zone)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -59,7 +61,7 @@ func Put(w *Wrapper, cnr *container.Container) (*cid.ID, error) {
|
|||
// encountered that caused the saving to interrupt.
|
||||
//
|
||||
// If TryNotary is provided, calls notary contract.
|
||||
func (w *Wrapper) Put(cnr, key, sig, token []byte) error {
|
||||
func (w *Wrapper) Put(cnr, key, sig, token []byte, name, zone string) error {
|
||||
if len(sig) == 0 || len(key) == 0 {
|
||||
return errNilArgument
|
||||
}
|
||||
|
@ -70,6 +72,7 @@ func (w *Wrapper) Put(cnr, key, sig, token []byte) error {
|
|||
args.SetSignature(sig)
|
||||
args.SetPublicKey(key)
|
||||
args.SetSessionToken(token)
|
||||
args.SetNativeNameWithZone(name, zone)
|
||||
|
||||
err := w.client.Put(args)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue