1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-08-31 21:08:14 +02:00

transport/redis_pubsub/redis.go rename to publisher.go

This commit is contained in:
Henrik Hautakoski 2023-03-07 11:33:53 +01:00
parent b46c070948
commit 19b93495ee
3 changed files with 11 additions and 11 deletions

View file

@ -1,32 +0,0 @@
package redis_pubsub
import (
"context"
"eosio-ship-trace-reader/transport"
"github.com/go-redis/redis/v8"
)
type RedisPubsub struct {
pipeline redis.Pipeliner
ctx context.Context
ns Namespace
}
func New(client *redis.Client, ns Namespace) *RedisPubsub {
return &RedisPubsub{
pipeline: client.Pipeline(),
ctx: client.Context(),
ns: ns,
}
}
func (r *RedisPubsub) Publish(channel transport.ChannelInterface, payload []byte) error {
return r.pipeline.Publish(r.ctx, r.ns.NewKey(channel).String(), payload).Err()
}
func (r *RedisPubsub) Flush() error {
_, err := r.pipeline.Exec(r.ctx)
return err
}