2022-12-23 17:35:35 +00:00
|
|
|
package frostfs
|
2020-09-08 08:38:23 +00:00
|
|
|
|
|
|
|
import (
|
2021-10-22 10:06:08 +00:00
|
|
|
"fmt"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
2022-07-28 16:22:32 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/state"
|
2020-09-08 08:38:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Unbind struct {
|
2023-04-26 13:25:50 +00:00
|
|
|
BindCommon
|
2020-09-08 08:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 16:22:32 +00:00
|
|
|
func ParseUnbind(e *state.ContainedNotificationEvent) (event.Event, error) {
|
2020-09-08 08:38:23 +00:00
|
|
|
var (
|
|
|
|
ev Unbind
|
|
|
|
err error
|
|
|
|
)
|
|
|
|
|
2021-10-22 10:06:08 +00:00
|
|
|
params, err := event.ParseStackArray(e)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("could not parse stack items from notify event: %w", err)
|
|
|
|
}
|
|
|
|
|
2023-04-26 13:25:50 +00:00
|
|
|
err = parseBind(&ev.BindCommon, params)
|
2020-09-08 08:38:23 +00:00
|
|
|
if err != nil {
|
2021-05-31 18:09:02 +00:00
|
|
|
return nil, err
|
2020-09-08 08:38:23 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 13:25:50 +00:00
|
|
|
ev.TxHashValue = e.Container
|
2021-11-11 08:59:14 +00:00
|
|
|
|
2020-09-08 08:38:23 +00:00
|
|
|
return ev, nil
|
|
|
|
}
|