news_manager

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNewsManager

func NewNewsManager(store Store, natsHostname string, natsPort string) (om.NewsManager, error)

Types

type InMemoryNewsStore

type InMemoryNewsStore struct {
	// contains filtered or unexported fields
}

InMemoryNewsStore manages a UserEvents data structure

func NewInMemoryNewsStore

func NewInMemoryNewsStore() *InMemoryNewsStore

func (*InMemoryNewsStore) AddEvent

func (m *InMemoryNewsStore) AddEvent(username string, event *om.LinkManagerEvent) (err error)

func (*InMemoryNewsStore) GetNews

func (m *InMemoryNewsStore) GetNews(username string, startIndex int) (events []*om.LinkManagerEvent, nextIndex int, err error)

type NewsManager

type NewsManager struct {
	// contains filtered or unexported fields
}

func (*NewsManager) GetNews

func (m *NewsManager) GetNews(req om.GetNewsRequest) (resp om.GetNewsResult, err error)

func (*NewsManager) OnLinkAdded

func (m *NewsManager) OnLinkAdded(username string, link *om.Link)

func (*NewsManager) OnLinkDeleted

func (m *NewsManager) OnLinkDeleted(username string, url string)

func (*NewsManager) OnLinkUpdated

func (m *NewsManager) OnLinkUpdated(username string, link *om.Link)

type RedisNewsStore

type RedisNewsStore struct {
	// contains filtered or unexported fields
}

RedisNewsStore manages a UserEvents data structure

func (*RedisNewsStore) AddEvent

func (m *RedisNewsStore) AddEvent(username string, event *om.LinkManagerEvent) (err error)

func (*RedisNewsStore) GetNews

func (m *RedisNewsStore) GetNews(username string, startIndex int) (events []*om.LinkManagerEvent, nextIndex int, err error)

type Store

type Store interface {
	GetNews(username string, startIndex int) (events []*om.LinkManagerEvent, nextIndex int, err error)
	AddEvent(username string, event *om.LinkManagerEvent) (err error)
}

func NewRedisNewsStore

func NewRedisNewsStore(address string) (store Store, err error)

Jump to

Keyboard shortcuts

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