2021-11-26 12:19:20 +00:00
|
|
|
package morphsubnet
|
|
|
|
|
|
|
|
import (
|
2022-12-23 17:35:35 +00:00
|
|
|
"github.com/TrueCloudLab/frostfs-node/pkg/morph/client"
|
2021-11-26 12:19:20 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
|
|
)
|
|
|
|
|
|
|
|
// DeletePrm groups parameters of Delete method of Subnet contract.
|
|
|
|
type DeletePrm struct {
|
|
|
|
cliPrm client.InvokePrm
|
|
|
|
|
2023-02-21 11:42:45 +00:00
|
|
|
args [1]any
|
2021-11-26 12:19:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|
|
|
|
|
2023-02-05 15:59:38 +00:00
|
|
|
// SetID sets identifier of the subnet to be removed in a binary FrostFS API protocol format.
|
2021-11-26 12:19:20 +00:00
|
|
|
func (x *DeletePrm) SetID(id []byte) {
|
|
|
|
x.args[0] = id
|
|
|
|
}
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// DeleteRes groups the resulting values of Delete method of Subnet contract.
|
2021-11-26 12:19:20 +00:00
|
|
|
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) {
|
2022-01-29 13:06:36 +00:00
|
|
|
prm.cliPrm.SetMethod(deleteMethod)
|
2021-11-26 12:19:20 +00:00
|
|
|
prm.cliPrm.SetArgs(prm.args[:]...)
|
|
|
|
|
|
|
|
err := x.client.Invoke(prm.cliPrm)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return new(DeleteRes), nil
|
|
|
|
}
|