topology-foundation / topchain-node

MIT License
2 stars 7 forks source link

impr: Create a secondary mapping<providerAddress, subscription[]> #8

Closed JanLewDev closed 1 month ago

JanLewDev commented 1 month ago

Create a secondary mapping using the KVStore to avoid the following pagination query in x/subscription/keeper/query_subscription.go:

var subscriptions []types.Subscription
pageRes, err := query.Paginate(store, req.Pagination, func(key []byte, value []byte) error {
    var subscription types.Subscription
    if err := k.cdc.Unmarshal(value, &subscription); err != nil {
        return err
    }

    if subscription.Provider == req.Provider {
        subscriptions = append(subscriptions, subscription)
    }
    return nil
})
sfroment commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I used go for many years, and shall be good to do this one

How I plan on tackling this issue

understand the code base and do what is asked

d-roak commented 1 month ago

go ahead