Documentation ¶
Index ¶
- Constants
- Variables
- func Clean(db *sql.DB, tableName string) error
- func CreateTable(db *sql.DB, tableName string) error
- type DBKey
- type DBOption
- type DBStore
- func (d *DBStore) Count() (int, error)
- func (d *DBStore) GetAll() ([]gowakuPersistence.StoredMessage, error)
- func (d *DBStore) GetStoredMessage(row *sql.Rows) (gowakuPersistence.StoredMessage, error)
- func (d *DBStore) MostRecentTimestamp() (int64, error)
- func (d *DBStore) Put(env *protocol.Envelope) error
- func (d *DBStore) Query(query *storepb.HistoryQuery) (*storepb.Index, []gowakuPersistence.StoredMessage, error)
- func (d *DBStore) Start(ctx context.Context, timesource timesource.Timesource) error
- func (d *DBStore) Stop()
- func (d *DBStore) Validate(env *protocol.Envelope) error
- type Hash
- type ProtectedTopic
- type ProtectedTopicsStore
- func (p *ProtectedTopicsStore) Close() error
- func (p *ProtectedTopicsStore) FetchPrivateKey(topic string) (privKey *ecdsa.PrivateKey, err error)
- func (p *ProtectedTopicsStore) Insert(pubsubTopic string, privKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey) error
- func (p *ProtectedTopicsStore) ProtectedTopics() ([]ProtectedTopic, error)
- type Queries
Constants ¶
const ( TimestampLength = 8 HashLength = 32 DigestLength = HashLength PubsubTopicLength = HashLength DBKeyLength = TimestampLength + PubsubTopicLength + DigestLength )
const MaxTimeVariance = time.Duration(20) * time.Second
MaxTimeVariance is the maximum duration in the future allowed for a message timestamp
Variables ¶
var ErrFutureMessage = errors.New("message timestamp in the future")
var ( // ErrInvalidByteSize is returned when DBKey can't be created // from a byte slice because it has invalid length. ErrInvalidByteSize = errors.New("byte slice has invalid length") )
var ErrInvalidCursor = errors.New("invalid cursor")
var ErrMessageTooOld = errors.New("message too old")
Functions ¶
Types ¶
type DBKey ¶ added in v0.172.1
type DBKey struct {
// contains filtered or unexported fields
}
DBKey key to be stored in a db.
type DBOption ¶ added in v0.106.1
DBOption is an optional setting that can be used to configure the DBStore
type DBStore ¶ added in v0.106.1
type DBStore struct {
// contains filtered or unexported fields
}
DBStore is a MessageProvider that has a *sql.DB connection
func NewDBStore ¶ added in v0.106.1
Creates a new DB store using the db specified via options. It will create a messages table if it does not exist and clean up records according to the retention policy used
func (*DBStore) GetAll ¶ added in v0.106.1
func (d *DBStore) GetAll() ([]gowakuPersistence.StoredMessage, error)
GetAll returns all the stored WakuMessages
func (*DBStore) GetStoredMessage ¶ added in v0.106.1
func (d *DBStore) GetStoredMessage(row *sql.Rows) (gowakuPersistence.StoredMessage, error)
GetStoredMessage is a helper function used to convert a `*sql.Rows` into a `StoredMessage`
func (*DBStore) MostRecentTimestamp ¶ added in v0.106.1
MostRecentTimestamp returns an unix timestamp with the most recent senderTimestamp in the message table
func (*DBStore) Query ¶ added in v0.106.1
func (d *DBStore) Query(query *storepb.HistoryQuery) (*storepb.Index, []gowakuPersistence.StoredMessage, error)
Query retrieves messages from the DB
func (*DBStore) Start ¶ added in v0.117.1
func (d *DBStore) Start(ctx context.Context, timesource timesource.Timesource) error
type Hash ¶ added in v0.172.1
type Hash [HashLength]byte
type ProtectedTopic ¶ added in v0.166.1
type ProtectedTopicsStore ¶ added in v0.166.1
type ProtectedTopicsStore struct {
// contains filtered or unexported fields
}
DBStore is a MessageProvider that has a *sql.DB connection
func NewProtectedTopicsStore ¶ added in v0.166.1
Creates a new DB store using the db specified via options. It will create a messages table if it does not exist and clean up records according to the retention policy used
func (*ProtectedTopicsStore) Close ¶ added in v0.166.1
func (p *ProtectedTopicsStore) Close() error
func (*ProtectedTopicsStore) FetchPrivateKey ¶ added in v0.166.1
func (p *ProtectedTopicsStore) FetchPrivateKey(topic string) (privKey *ecdsa.PrivateKey, err error)
func (*ProtectedTopicsStore) Insert ¶ added in v0.166.1
func (p *ProtectedTopicsStore) Insert(pubsubTopic string, privKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey) error
func (*ProtectedTopicsStore) ProtectedTopics ¶ added in v0.166.1
func (p *ProtectedTopicsStore) ProtectedTopics() ([]ProtectedTopic, error)
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
Queries are the sqlite queries for a given table.
func NewQueries ¶
NewQueries creates a new set of queries for the passed table