store

package
v0.0.0-...-ba2213e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageQueueExt

type MessageQueueExt struct {
	message.MessageQueue
	Offset int64 `json:"offset"`
}

type OffsetSerializeWrapper

type OffsetSerializeWrapper struct {
	// 保存每个队列的offset
	sync.RWMutex `json:"-"`
	OffsetTable  map[string]MessageQueueExt `json:"offsetTable"`
}

func NewOffsetSerializeWrapper

func NewOffsetSerializeWrapper() *OffsetSerializeWrapper

type OffsetStore

type OffsetStore interface {
	Load()
	// Persist all offsets,may be in local storage or remote name server
	// Set<MessageQueue>
	PersistAll(mqs set.Set)

	// Persist the offset,may be in local storage or remote name server
	Persist(mq *message.MessageQueue)

	// Remove offset
	RemoveOffset(mq *message.MessageQueue)

	// Get offset from local storage
	ReadOffset(mq *message.MessageQueue, rType ReadOffsetType) int64
	// Update the offset,store it in memory
	UpdateOffset(mq *message.MessageQueue, offset int64, increaseOnly bool)
}

type ReadOffsetType

type ReadOffsetType int
const (
	READ_FROM_MEMORY ReadOffsetType = iota
	READ_FROM_STORE
	MEMORY_FIRST_THEN_STORE
)

func (ReadOffsetType) String

func (rType ReadOffsetType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL