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
|
@ -161,7 +161,7 @@ func (cp *Processor) ListenerNotaryParsers() []event.NotaryParserInfo {
|
|||
var (
|
||||
p event.NotaryParserInfo
|
||||
|
||||
pp = make([]event.NotaryParserInfo, 0, 3)
|
||||
pp = make([]event.NotaryParserInfo, 0, 4)
|
||||
)
|
||||
|
||||
p.SetMempoolType(mempoolevent.TransactionAdded)
|
||||
|
@ -172,6 +172,11 @@ func (cp *Processor) ListenerNotaryParsers() []event.NotaryParserInfo {
|
|||
p.SetParser(containerEvent.ParsePutNotary)
|
||||
pp = append(pp, p)
|
||||
|
||||
// container named put
|
||||
p.SetRequestType(containerEvent.PutNamedNotaryEvent)
|
||||
p.SetParser(containerEvent.ParsePutNamedNotary)
|
||||
pp = append(pp, p)
|
||||
|
||||
// container delete
|
||||
p.SetRequestType(containerEvent.DeleteNotaryEvent)
|
||||
p.SetParser(containerEvent.ParseDeleteNotary)
|
||||
|
@ -190,7 +195,7 @@ func (cp *Processor) ListenerNotaryHandlers() []event.NotaryHandlerInfo {
|
|||
var (
|
||||
h event.NotaryHandlerInfo
|
||||
|
||||
hh = make([]event.NotaryHandlerInfo, 0, 3)
|
||||
hh = make([]event.NotaryHandlerInfo, 0, 4)
|
||||
)
|
||||
|
||||
h.SetScriptHash(cp.cnrClient.ContractAddress())
|
||||
|
@ -201,6 +206,10 @@ func (cp *Processor) ListenerNotaryHandlers() []event.NotaryHandlerInfo {
|
|||
h.SetHandler(cp.handlePut)
|
||||
hh = append(hh, h)
|
||||
|
||||
// container named put (same handler)
|
||||
h.SetRequestType(containerEvent.PutNamedNotaryEvent)
|
||||
hh = append(hh, h)
|
||||
|
||||
// container delete
|
||||
h.SetRequestType(containerEvent.DeleteNotaryEvent)
|
||||
h.SetHandler(cp.handleDelete)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue