apibara / dna

Apibara is the fastest platform to build production-grade indexers that connect onchain data to web2 services.
https://www.apibara.com/
Apache License 2.0
168 stars 32 forks source link

Support Redis for persistence #314

Closed fracek closed 6 months ago

fracek commented 6 months ago

Is your feature request related to a problem? Please describe.

At the moment the only two options for persistence are:

We need a third way.

Describe the solution you'd like

Redis sits in the middle between the two options:

The idea is to serialize the sink state to redis using a key like apibara:sink:${sinkId}. Unlike what we do in etcd, we should serialize the state as json so it's easier to debug when things go wrong.

Additional context

This blog article contains a simple implementation of a distributed lock with a single redis instance.

fracek commented 6 months ago

To be honest the lock method in the persistence interface can come later, it's not necessary now.