storage

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovedUsers

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

ApprovedUsers is a storage for approved users ids, not thread-safe.

Clients should not reuse ApprovedUsers for multiple goroutines, create a new instance instead. Even if access to Store and Read is synchronized, the underlying file is not.

func NewApprovedUsers

func NewApprovedUsers(filePath string) *ApprovedUsers

NewApprovedUsers creates a new ApprovedUsers storage

func (*ApprovedUsers) Read

func (au *ApprovedUsers) Read(p []byte) (n int, err error)

Read reads ids from the storage Each read returns one id, followed by a newline

func (*ApprovedUsers) Store

func (au *ApprovedUsers) Store(ids []string) error

Store saves ids to the storage, overwriting the existing content data is stored in little endian, binary format. 8 bytes for each id.

Jump to

Keyboard shortcuts

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