forked from TrueCloudLab/frostfs-node
[#973] ir: Listen and process Put/Delete events of Subnet contract
Define notification events, implement parsers. Add morph client of Subnet contract. Listen, verify and approve events in Inner Ring app. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
214c2bd0cb
commit
41eaa1e246
22 changed files with 1278 additions and 12 deletions
40
pkg/morph/client/subnet/delete.go
Normal file
40
pkg/morph/client/subnet/delete.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package morphsubnet
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
)
|
||||
|
||||
// DeletePrm groups parameters of Delete method of Subnet contract.
|
||||
type DeletePrm struct {
|
||||
cliPrm client.InvokePrm
|
||||
|
||||
args [1]interface{}
|
||||
}
|
||||
|
||||
// SetTxHash sets hash of the transaction which spawned the notification.
|
||||
// Ignore this parameter for new requests.
|
||||
func (x *DeletePrm) SetTxHash(hash util.Uint256) {
|
||||
x.cliPrm.SetHash(hash)
|
||||
}
|
||||
|
||||
// SetID sets identifier of the subnet to be removed in a binary NeoFS API protocol format.
|
||||
func (x *DeletePrm) SetID(id []byte) {
|
||||
x.args[0] = id
|
||||
}
|
||||
|
||||
// DeleteRes groups resulting values of Delete method of Subnet contract.
|
||||
type DeleteRes struct{}
|
||||
|
||||
// Delete removes subnet though the call of the corresponding method of the Subnet contract.
|
||||
func (x Client) Delete(prm DeletePrm) (*DeleteRes, error) {
|
||||
prm.cliPrm.SetMethod("delete")
|
||||
prm.cliPrm.SetArgs(prm.args[:]...)
|
||||
|
||||
err := x.client.Invoke(prm.cliPrm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return new(DeleteRes), nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue