frostfs-node/pkg/morph/client/container/wrapper/estimations.go
Leonard Lyubich 9f122f279a [#496] morph/container: Construct client wrapper in notary mode
Some of the client wrapper's methods should produce notary contract's
invocations. In previous implementation all wrappers provided separate
methods to do it. Since notary and non-notary invocation scenarios have very
different goals, it makes sense to separate the scenarios of using the
client wrapper  at the stage of its creation.

Define `Option` constructor for container client wrapper. Add `TryNotary`
option which enables tries of the notary invocations on underlying static
client. Mark all notary-dedicated methods as deprecated.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-25 16:35:52 +03:00

45 lines
1.2 KiB
Go

package wrapper
import (
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
)
// StartEstimation votes to produce start estimation notification.
func (w *Wrapper) StartEstimation(epoch uint64) error {
args := container.StartEstimation{}
args.SetEpoch(int64(epoch))
return w.client.StartEstimation(args)
}
// StartEstimationNotary votes to produce start estimation notification through
// notary contract.
//
// Deprecated: provide TryNotary() option to NewFromMorph
// and use StartEstimation.
func (w *Wrapper) StartEstimationNotary(epoch uint64) error {
args := container.StartEstimation{}
args.SetEpoch(int64(epoch))
return w.client.StartEstimationNotary(args)
}
// StopEstimation votes to produce stop estimation notification.
func (w *Wrapper) StopEstimation(epoch uint64) error {
args := container.StopEstimation{}
args.SetEpoch(int64(epoch))
return w.client.StopEstimation(args)
}
// StopEstimationNotary votes to produce stop estimation notification through
// notary contract.
//
// Deprecated: provide TryNotary() option to NewFromMorph
// and use StopEstimation.
func (w *Wrapper) StopEstimationNotary(epoch uint64) error {
args := container.StopEstimation{}
args.SetEpoch(int64(epoch))
return w.client.StopEstimationNotary(args)
}