generated from TrueCloudLab/basic
router: Make defaultChainRouter match a request by listing chains with iterator #62
Labels
No labels
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/policy-engine#62
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/policy-engine:feat/list_by_iterator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
NewContractStorage
receiverpcInvoker
- that's necessary to construct an invoker.commonclient.ReadIteratorItems
inListMorphRuleChains
forContractStorage/ContractStorageReader
.0bb48d0a0c
tob2c07fb175
b2c07fb175
to6a681bbd6d
6a681bbd6d
tof1b895d49d
WIP: router: Make defaultChainRouter match a request by listing chains with iteratorto router: Make defaultChainRouter match a request by listing chains with iteratorPR is waiting for frostfs-contract#84
f1b895d49d
to9fadbce609
@ -105,3 +110,3 @@
}
items, err := s.contractInterface.ListChainsByPrefix(big.NewInt(int64(kind)), target.Name, []byte(name))
sid, it, err := s.contractInterface.IteratorChainsByPrefix(big.NewInt(int64(kind)), target.Name, []byte(name))
This will be slow, we should try using prefetch script.
I have introduced iteration with prefetch script. Please, check this out!
router: Make defaultChainRouter match a request by listing chains with iteratorto WIP: router: Make defaultChainRouter match a request by listing chains with iteratorWIP: router: Make defaultChainRouter match a request by listing chains with iteratorto WIP: router: Make defaultChainRouter match a request by listing chains with iterator9fadbce609
to74490eb4c0
74490eb4c0
toea9641f966
ea9641f966
to3ea27b6341
WIP: router: Make defaultChainRouter match a request by listing chains with iteratorto router: Make defaultChainRouter match a request by listing chains with iterator@ -112,0 +143,4 @@
return chains, nil
}
script, err := smartcontract.CreateCallAndPrefetchIteratorScript(hash, method, batchSize, params...)
Question: Can we use
func ReadIteratorItems(inv Invoker, batchSize int, contract util.Uint160, method string, params ...any) ([]stackitem.Item, error) {
?
Oh, that's a good find! I am going to check if I can use this, thank you!
That worked out, thanks!
router: Make defaultChainRouter match a request by listing chains with iteratorto WIP: router: Make defaultChainRouter match a request by listing chains with iterator3ea27b6341
to84b8b6952a
84b8b6952a
to75134a62d7
WIP: router: Make defaultChainRouter match a request by listing chains with iteratorto router: Make defaultChainRouter match a request by listing chains with iterator75134a62d7
toa25b632946
@ -15,6 +16,8 @@ import (
"github.com/nspcc-dev/neo-go/pkg/rpcclient/actor"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
Empty line
fixed
@ -39,3 +50,3 @@
var _ engine.MorphRuleChainStorageReader = (*ContractStorageReader)(nil)
func NewContractStorage(actor client.Actor, contract util.Uint160) *ContractStorage {
func NewContractStorage(actor client.Actor, rpcInvoker neoinvoker.RPCInvoke, contract util.Uint160) *ContractStorage {
Do we really need pass actor and invoker separately? Maybe we can pass just more general actor?
It is a good point. Actually, I've already tried many ways to generilize that and here is a final solution:
client.Actor
andneoinvoker.RPCInvoke
in one interface, because they are intersected by methodTraverseIterator
,TerminateSession
(duplicate method
error)Invoker
that uses working connection (basically, websocket connection)a25b632946
to348786d61c
348786d61c
toafb37f8f61
afb37f8f61
toc8d06ac8d1
c8d06ac8d1
to4cbf51f897
4cbf51f897
to6abac0f5f6
6abac0f5f6
to1c29e2f90a
1c29e2f90a
to0b907e7eb2
@ -110,2 +146,4 @@
big.NewInt(int64(kind)), target.Name, []byte(name),
}
items, err := commonclient.ReadIteratorItems(inv, batchSize, hash, method, params...)
Inside this method we don't explicitly terminate session so it can lead to
unwrap session iterator: Internal error (-32603) - max session capacity reached
. Maybe we can update this method in contract first?You're absolutely correct. I'll fix this in
frostfs-contract
go.mod
has been updated with TrueCloudLab/frostfs-contract#850b907e7eb2
to4acfe0e62f