goshuirc / bnc

a simple irc bouncer written in go
https://goshubnc.org/
MIT License
17 stars 3 forks source link

Store query+channel logs in datastore #18

Closed DanielOaks closed 7 years ago

DanielOaks commented 7 years ago

I'm really interested in how exactly to handle this and store those messages. What sort of features will this message store be used by? IRCv3 stuff is throwing the idea of message searching / retrieval, arbitrary playback of messages and the like. Those seem to be useful features to implement with this sorta system backing it.

prawnsalad commented 7 years ago

With the ideas floating around and the features I've got in mind we would need to support the following:

Not all message datastores may support retrieval or searching so these may be optional. While we can add an option for searching on different fields, we can just default to "search everything" for the time being and add the new options in future as needed.

With all that said, a message datastore could implement the following interface:

.Store(userId, ircmsg)
.GetFromTime(userId, time, numMessages)
.GetBeforeTime(userId, time, numMessages)
.Search(userId, searchField, searchTerm, timeFrom, timeTo, numMessages)

.SupportsStore bool
.SupportsRetrieve bool
.SupportsSearch bool

For a quick .txt log datastore, only .Store could be implemented which just throws a structures message to disk.

prawnsalad commented 7 years ago

Note; Logging could be implemented using components to keep it logically separated from the core BNC functionality https://github.com/goshuirc/bnc/pull/19

prawnsalad commented 7 years ago

An interface is now in the logger component that allows multiple running message loggers each with different support: