storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package storage provides storage implementations for sessions and peers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultSessionStorage

func NewDefaultSessionStorage(path string) (session.Storage, io.Closer, error)

NewDefaultSessionStorage creates a bbolt-based session storage at the given path. The returned closer releases the underlying database file.

func SetupUpdateHook

func SetupUpdateHook(next telegram.UpdateHandler, p PeerStorage) telegram.UpdateHandler

SetupUpdateHook wraps an update handler so peers seen in updates are persisted to the peer storage.

Types

type BboltStateStorage added in v0.2.0

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

BboltStateStorage implements syncstate.StateStorage using bbolt for robust persistence.

func NewBboltStateStorage added in v0.2.0

func NewBboltStateStorage(db *bolt.DB) (*BboltStateStorage, error)

NewBboltStateStorage creates a new state storage over a bolt database.

func NewDefaultStateStorage added in v0.2.0

func NewDefaultStateStorage(path string) (*BboltStateStorage, io.Closer, error)

NewDefaultStateStorage creates a bbolt-based sync state storage at the given path. The returned closer releases the underlying database file.

func (*BboltStateStorage) ForEachChannelPTS added in v0.2.0

func (b *BboltStateStorage) ForEachChannelPTS(_ context.Context, clientID int64, fn func(channelID int64, pts int32) error) error

ForEachChannelPTS iterates over all channel PTS values for a client.

func (*BboltStateStorage) IsDialogNotLoaded added in v0.2.0

func (b *BboltStateStorage) IsDialogNotLoaded(_ context.Context, clientID, dialogID int64) (bool, error)

IsDialogNotLoaded retrieves the recovery flag for a dialog.

func (*BboltStateStorage) LoadChannelPTS added in v0.2.0

func (b *BboltStateStorage) LoadChannelPTS(_ context.Context, clientID, channelID int64) (int32, bool, error)

LoadChannelPTS retrieves the channel PTS.

func (*BboltStateStorage) LoadState added in v0.2.0

func (b *BboltStateStorage) LoadState(_ context.Context, clientID int64) (syncstate.StateSnapshot, bool, error)

LoadState retrieves the global state snapshot.

func (*BboltStateStorage) SaveChannelPTS added in v0.2.0

func (b *BboltStateStorage) SaveChannelPTS(_ context.Context, clientID, channelID int64, pts int32) error

SaveChannelPTS stores the channel PTS atomically.

func (*BboltStateStorage) SaveState added in v0.2.0

func (b *BboltStateStorage) SaveState(_ context.Context, clientID int64, snapshot syncstate.StateSnapshot) error

SaveState stores the global state snapshot robustly.

func (*BboltStateStorage) SetDialogNotLoaded added in v0.2.0

func (b *BboltStateStorage) SetDialogNotLoaded(_ context.Context, clientID, dialogID int64, notLoaded bool) error

type PeerStorage

type PeerStorage = storage.PeerStorage

PeerStorage is an alias for the gotd/contrib peer storage interface.

func NewDefaultPeerStorage

func NewDefaultPeerStorage(path string) (PeerStorage, io.Closer, error)

NewDefaultPeerStorage creates a bbolt-based peer storage at the given path. The returned closer releases the underlying database file.

Jump to

Keyboard shortcuts

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