Documentation
¶
Index ¶
- type Alert
- type Send
- type Store
- func (s *Store) Close() error
- func (s *Store) GetCursor(ctx context.Context, sourceID string) (height uint64, hash string, ok bool, err error)
- func (s *Store) InsertAlert(ctx context.Context, a Alert) error
- func (s *Store) InsertSend(ctx context.Context, srec Send) error
- func (s *Store) IsDuplicate(ctx context.Context, key string, now time.Time) (bool, error)
- func (s *Store) MarkDedupe(ctx context.Context, key string, expiresAt time.Time) error
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) UpsertCursor(ctx context.Context, sourceID string, height uint64, hash string) error
- func (s *Store) WithTx(ctx context.Context, fn func(tx *sql.Tx) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct {
ID string
RuleID string
Fingerprint string
TxHash string
PayloadJSON string
CreatedAt time.Time
}
Alert represents an emitted alert record.
type Send ¶
type Send struct {
AlertID string
SinkID string
Status string
ResponseCode int
CreatedAt time.Time
}
Send represents a sink delivery record.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps SQLite-backed persistence for cursors, alerts, sends, and dedupe.
func (*Store) GetCursor ¶
func (s *Store) GetCursor(ctx context.Context, sourceID string) (height uint64, hash string, ok bool, err error)
GetCursor retrieves the cursor for a source.
func (*Store) InsertAlert ¶
InsertAlert stores an alert; primary key enforces exactly-once insertion.
func (*Store) InsertSend ¶
InsertSend records a sink delivery attempt; primary key enforces exactly-once per alert/sink.
func (*Store) IsDuplicate ¶
IsDuplicate returns true if the key exists and is not expired; expired entries are pruned.
func (*Store) MarkDedupe ¶
MarkDedupe sets or refreshes a dedupe key until expiresAt.
Click to show internal directories.
Click to hide internal directories.