Documentation
¶
Index ¶
- func CheckDuplicateEvent(ctx context.Context, evt nostr.Event) (bool, error)
- func DisconnectDB(client *mongo.Client)
- func EnsureIndexes(client *mongo.Client, databaseName string) error
- func GetAllAuthorsFromRelay(cfg *cfgType.ServerConfig) []string
- func GetClient() *mongo.Client
- func GetCollection(kind int) *mongo.Collection
- func GetDatabaseName() string
- func InitDB(cfg *cfgType.ServerConfig) (*mongo.Client, error)
- func IsClientHealthy(ctx context.Context) bool
- func PurgeOldEventsOptimized(cfg *cfgType.EventPurgeConfig)
- func QueryEvents(filters []nostr.Filter, client *mongo.Client, databaseName string) ([]nostr.Event, error)
- func ScheduleEventPurgingOptimized(cfg *cfgType.ServerConfig)
- func StoreMongoEvent(ctx context.Context, evt nostr.Event, client nostr.ClientInterface)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDuplicateEvent ¶
CheckDuplicateEvent checks if an event with the same ID already exists in the collection. Returns (isDuplicate, error) where error indicates a system error, not a duplicate.
func GetAllAuthorsFromRelay ¶
func GetAllAuthorsFromRelay(cfg *cfgType.ServerConfig) []string
GetAllAuthorsFromRelay fetches all unique authors from MongoDB.
func GetCollection ¶
func GetCollection(kind int) *mongo.Collection
func GetDatabaseName ¶
func GetDatabaseName() string
GetDatabaseName returns the database name from config
func IsClientHealthy ¶ added in v0.4.1
IsClientHealthy checks if the MongoDB client is available and connected
func PurgeOldEventsOptimized ¶
func PurgeOldEventsOptimized(cfg *cfgType.EventPurgeConfig)
PurgeOldEventsOptimized removes old events using cached whitelist data for bulk operations
func QueryEvents ¶
func QueryEvents(filters []nostr.Filter, client *mongo.Client, databaseName string) ([]nostr.Event, error)
QueryEvents queries events from the MongoDB collection(s) based on filters
func ScheduleEventPurgingOptimized ¶
func ScheduleEventPurgingOptimized(cfg *cfgType.ServerConfig)
ScheduleEventPurgingOptimized runs the optimized event purging at configurable intervals
func StoreMongoEvent ¶
StoreMongoEvent processes and stores an event based on its kind
Types ¶
This section is empty.