store

package
v0.0.0-...-130f5e9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: Apache-2.0 Imports: 3 Imported by: 1

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