mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
move writer interface and redis publish from api module as these are for the server side.
This commit is contained in:
parent
a94fbe191a
commit
24bf44a175
5 changed files with 11 additions and 5 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/eosswedenorg/thalos/api"
|
||||
. "github.com/eosswedenorg/thalos/api/redis"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/eosswedenorg/thalos/api"
|
||||
. "github.com/eosswedenorg/thalos/api/redis"
|
||||
|
||||
"github.com/go-redis/redismock/v9"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
package api
|
||||
package driver
|
||||
|
||||
import "github.com/eosswedenorg/thalos/api"
|
||||
|
||||
// Writer interface defines the required methods
|
||||
// to send messages over an channel.
|
||||
|
|
@ -7,7 +9,7 @@ package api
|
|||
type Writer interface {
|
||||
// Write writes a message over a channel.
|
||||
// The message may or may not be buffered depending on the implementation.
|
||||
Write(channel Channel, payload []byte) error
|
||||
Write(channel api.Channel, payload []byte) error
|
||||
|
||||
// Flush writes any buffered messages to the channel.
|
||||
// If the implementation does not support buffering. this is a noop.
|
||||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/eosswedenorg/thalos/api"
|
||||
"github.com/eosswedenorg/thalos/api/message"
|
||||
"github.com/eosswedenorg/thalos/app/abi"
|
||||
"github.com/eosswedenorg/thalos/app/driver"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ type ShipProcessor struct {
|
|||
abi *abi.AbiManager
|
||||
|
||||
// Writer to send messages to.
|
||||
writer api.Writer
|
||||
writer driver.Writer
|
||||
|
||||
// Encoder used to encode messages
|
||||
encode message.Encoder
|
||||
|
|
@ -51,7 +52,7 @@ type ShipProcessor struct {
|
|||
}
|
||||
|
||||
// SpawnProcessor creates a new ShipProccessor that consumes the shipclient.Stream passed to it.
|
||||
func SpawnProccessor(shipStream *shipclient.Stream, writer api.Writer, abi *abi.AbiManager, codec message.Codec) *ShipProcessor {
|
||||
func SpawnProccessor(shipStream *shipclient.Stream, writer driver.Writer, abi *abi.AbiManager, codec message.Codec) *ShipProcessor {
|
||||
processor := &ShipProcessor{
|
||||
abi: abi,
|
||||
writer: writer,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"github.com/eosswedenorg/thalos/app"
|
||||
"github.com/eosswedenorg/thalos/app/abi"
|
||||
"github.com/eosswedenorg/thalos/app/config"
|
||||
driver "github.com/eosswedenorg/thalos/app/driver/redis"
|
||||
. "github.com/eosswedenorg/thalos/app/log"
|
||||
"github.com/nikoksr/notify"
|
||||
"github.com/nikoksr/notify/service/telegram"
|
||||
|
|
@ -314,7 +315,7 @@ func main() {
|
|||
|
||||
processor := app.SpawnProccessor(
|
||||
shClient,
|
||||
api_redis.NewPublisher(context.Background(), rdb, api_redis.Namespace{
|
||||
driver.NewPublisher(context.Background(), rdb, api_redis.Namespace{
|
||||
Prefix: conf.Redis.Prefix,
|
||||
ChainID: chain_id,
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue