fix(backend): fixed import issues related to ee version
This commit is contained in:
parent
02ef8dbf38
commit
b0de3fa6c9
4 changed files with 23 additions and 19 deletions
|
|
@ -2,9 +2,11 @@ package redis
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/go-redis/redis"
|
||||
config "openreplay/backend/internal/config/redis"
|
||||
"strings"
|
||||
|
||||
"github.com/go-redis/redis"
|
||||
|
||||
config "openreplay/backend/internal/config/redis"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@ package redis
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/go-redis/redis"
|
||||
"log"
|
||||
"net"
|
||||
redis2 "openreplay/backend/pkg/db/redis"
|
||||
"openreplay/backend/pkg/messages"
|
||||
"openreplay/backend/pkg/queue/types"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/go-redis/redis"
|
||||
|
||||
"openreplay/backend/pkg/messages"
|
||||
"openreplay/backend/pkg/queue/types"
|
||||
)
|
||||
|
||||
type idsInfo struct {
|
||||
|
|
@ -21,7 +22,7 @@ type idsInfo struct {
|
|||
type streamPendingIDsMap map[string]*idsInfo
|
||||
|
||||
type consumerImpl struct {
|
||||
client *redis2.Client
|
||||
client *Client
|
||||
group string
|
||||
streams []string
|
||||
idsPending streamPendingIDsMap
|
||||
|
|
@ -45,7 +46,7 @@ func (c *consumerImpl) Close() {
|
|||
panic("implement me")
|
||||
}
|
||||
|
||||
func NewConsumer(client *redis2.Client, group string, streams []string) types.Consumer {
|
||||
func NewConsumer(client *Client, group string, streams []string) types.Consumer {
|
||||
idsPending := make(streamPendingIDsMap)
|
||||
streamsCount := len(streams)
|
||||
for i := 0; i < streamsCount; i++ {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
package redis
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/go-redis/redis"
|
||||
redis2 "openreplay/backend/pkg/db/redis"
|
||||
|
||||
"openreplay/backend/pkg/queue/types"
|
||||
)
|
||||
|
||||
type producerImpl struct {
|
||||
client *redis2.Client
|
||||
client *Client
|
||||
}
|
||||
|
||||
func (c *producerImpl) Close(timeout int) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
log.Printf("Redis producer close")
|
||||
}
|
||||
|
||||
func NewProducer(client *redis2.Client) types.Producer {
|
||||
func NewProducer(client *Client) types.Producer {
|
||||
return &producerImpl{
|
||||
client: client,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"openreplay/backend/pkg/db/redis"
|
||||
"openreplay/backend/pkg/sessions"
|
||||
"time"
|
||||
|
||||
"openreplay/backend/pkg/db/redis"
|
||||
)
|
||||
|
||||
type cacheImpl struct {
|
||||
db *redis.Client
|
||||
}
|
||||
|
||||
func (c *cacheImpl) Set(session *sessions.Session) error {
|
||||
func (c *cacheImpl) Set(session *Session) error {
|
||||
if c.db == nil {
|
||||
return ErrDisabledCache
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ func (c *cacheImpl) Set(session *sessions.Session) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *cacheImpl) Get(sessionID uint64) (*sessions.Session, error) {
|
||||
func (c *cacheImpl) Get(sessionID uint64) (*Session, error) {
|
||||
if c.db == nil {
|
||||
return nil, ErrDisabledCache
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ func (c *cacheImpl) Get(sessionID uint64) (*sessions.Session, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
session := &sessions.Session{}
|
||||
session := &Session{}
|
||||
if err = json.Unmarshal([]byte(result), session); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -53,6 +53,6 @@ func (c *cacheImpl) Get(sessionID uint64) (*sessions.Session, error) {
|
|||
|
||||
var ErrDisabledCache = errors.New("cache is disabled")
|
||||
|
||||
func NewCache(db *redis.Client) sessions.Cache {
|
||||
func NewCache(db *redis.Client) Cache {
|
||||
return &cacheImpl{db: db}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue