Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EcsDataset ¶
type EcsDataset struct {
FileURL string `json:"fileUrl"`
LastModified int64 `json:"lastModified"`
Checksum string `json:"checksum"`
}
func (*EcsDataset) LastModifiedTime ¶
func (e *EcsDataset) LastModifiedTime() time.Time
type FileWatcherNotifier ¶
type FileWatcherNotifier struct {
// contains filtered or unexported fields
}
FileWatcherNotifier implements the Notifier interface using a file watcher.
func NewFileWatcherNotifier ¶
func NewFileWatcherNotifier(filePath string, reloadDelay time.Duration) (*FileWatcherNotifier, error)
NewFileWatcherNotifier creates a new FileWatcherNotifier.
func (*FileWatcherNotifier) Close ¶
func (fw *FileWatcherNotifier) Close() error
Close halts the file watcher.
func (*FileWatcherNotifier) WatchForChange ¶
func (fw *FileWatcherNotifier) WatchForChange(ctx context.Context, onReload func(filePath string) error) error
WatchForChange monitors the file for changes and triggers the onReload callback when necessary. It blocks until the context is canceled or an error occurs.
type Notifier ¶
type Notifier interface {
// WatchForChange monitors for changes and triggers the provided onReload function when a reload is needed.
WatchForChange(ctx context.Context, onReload func(file string) error) error
// Close stops any internal resources associated with the notifier.
Close() error
}
Notifier defines the interface for different notification mechanisms.
type ReloadManager ¶
type ReloadManager struct {
// contains filtered or unexported fields
}
ReloadManager manages the BloomFilterStore and handles notifications for reloading.
func NewReloadManager ¶
func NewReloadManager(store *store.BloomFilterStore, notifier Notifier) *ReloadManager
NewReloadManager creates a new ReloadManager with a specified notification mechanism.
func NewReloadManagerWithLogger ¶
func NewReloadManagerWithLogger(store *store.BloomFilterStore, notifier Notifier, logger *slog.Logger) *ReloadManager
NewReloadManager creates a new ReloadManager with a specified notification mechanism.
func (*ReloadManager) LastLoadTime ¶
func (m *ReloadManager) LastLoadTime() time.Time
func (*ReloadManager) Start ¶
func (m *ReloadManager) Start(ctx context.Context) error
Start begins listening for notifications to reload the Bloom filter.
func (*ReloadManager) Stop ¶
func (m *ReloadManager) Stop() error
Stop halts the notification process and waits for ongoing operations to complete.
type RemoteClient ¶
type RemoteClient interface {
// FetchMetadata retrieves the bloom filter metadata for the given chain and dataset
FetchMetadata(chain, dataset string) (*EcsDataset, error)
// DownloadFile downloads the file from the given URL to the destination path
DownloadFile(ctx context.Context, url string, dest string) error
}
RemoteClient defines the interface for all remote operations
func NewRemoteClient ¶
func NewRemoteClient(baseURL, clientID, clientSecret string, logger *slog.Logger) RemoteClient
type RemoteNotifier ¶
type RemoteNotifier struct {
// contains filtered or unexported fields
}
func NewRemoteNotifier ¶
func NewRemoteNotifierWithClient ¶
func NewRemoteNotifierWithClient(chain, dataset, localPath string, client RemoteClient, checkInterval time.Duration, logger *slog.Logger) *RemoteNotifier
func (*RemoteNotifier) Close ¶
func (n *RemoteNotifier) Close() error
func (*RemoteNotifier) WatchForChange ¶
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
}