github.com/glide-im/glide@v1.6.0/pkg/store/store.go (about)

     1  package store
     2  
     3  import (
     4  	"github.com/glide-im/glide/pkg/messages"
     5  	"github.com/glide-im/glide/pkg/subscription"
     6  )
     7  
     8  // MessageStore is a store for messages, used to store chat messages in messaging.Interface, its many be called multiple times,
     9  // but only the last updates will be stored.
    10  type MessageStore interface {
    11  
    12  	// StoreMessage stores chat message to database
    13  	StoreMessage(message *messages.ChatMessage) error
    14  
    15  	StoreOffline(message *messages.ChatMessage) error
    16  }
    17  
    18  type SubscriptionStore interface {
    19  
    20  	// NextSegmentSequence return the next segment of specified channel, and segment length.
    21  	NextSegmentSequence(id subscription.ChanID, info subscription.ChanInfo) (int64, int64, error)
    22  
    23  	// StoreChannelMessage stores a published message.
    24  	StoreChannelMessage(ch subscription.ChanID, msg *messages.ChatMessage) error
    25  }