You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
1 month ago
|
package controller
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
|
||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type StreamMsgDatabase interface {
|
||
|
CreateStreamMsg(ctx context.Context, model *model.StreamMsg) error
|
||
|
AppendStreamMsg(ctx context.Context, clientMsgID string, startIndex int, packets []string, end bool, deadlineTime time.Time) error
|
||
|
GetStreamMsg(ctx context.Context, clientMsgID string) (*model.StreamMsg, error)
|
||
|
}
|
||
|
|
||
|
func NewStreamMsgDatabase(db database.StreamMsg) StreamMsgDatabase {
|
||
|
return &streamMsgDatabase{db: db}
|
||
|
}
|
||
|
|
||
|
type streamMsgDatabase struct {
|
||
|
db database.StreamMsg
|
||
|
}
|
||
|
|
||
|
func (m *streamMsgDatabase) CreateStreamMsg(ctx context.Context, model *model.StreamMsg) error {
|
||
|
return m.db.CreateStreamMsg(ctx, model)
|
||
|
}
|
||
|
|
||
|
func (m *streamMsgDatabase) AppendStreamMsg(ctx context.Context, clientMsgID string, startIndex int, packets []string, end bool, deadlineTime time.Time) error {
|
||
|
return m.db.AppendStreamMsg(ctx, clientMsgID, startIndex, packets, end, deadlineTime)
|
||
|
}
|
||
|
|
||
|
func (m *streamMsgDatabase) GetStreamMsg(ctx context.Context, clientMsgID string) (*model.StreamMsg, error) {
|
||
|
return m.db.GetStreamMsg(ctx, clientMsgID)
|
||
|
}
|