Documentation ¶
Overview ¶
Package store manages the message database.
Index ¶
- type Message
- type Response
- type Retrieval
- type Session
- type SessionFlags
- type Store
- func (s *Store) CreateSession(session *Session)
- func (s *Store) DeleteModelImages(sid int)
- func (s *Store) DeleteSession(session *Session)
- func (s *Store) ExistSessions(start, end time.Time) bool
- func (st *Store) GetMessage(localID string) *Message
- func (st *Store) GetMessageByHash(hash string) *Message
- func (st *Store) GetResponses(to string) (responses []*Response)
- func (s *Store) GetRunningSessions() (list []*Session)
- func (s *Store) GetSession(id int) *Session
- func (st *Store) GetSessionMessages(sessionID int) (messages []*Message)
- func (s *Store) GetSessions(start, end time.Time) (list []*Session)
- func (st *Store) HasMessageHash(hash string) (id string)
- func (s *Store) ModelImage(sid int, pnum int) (fh *os.File)
- func (s *Store) ModelImageCount(sid int) (count int)
- func (st *Store) NextMessageID(prefix string) string
- func (st *Store) SaveMessage(m *Message)
- func (s *Store) SaveModelImage(sid int, pnum int, name string, body io.Reader)
- func (st *Store) SaveResponse(r *Response)
- func (st *Store) SessionHasMessages(sessionID int) bool
- func (s *Store) UpdateSession(session *Session)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { LocalID string `yaml:"localID"` Hash string `yaml:"hash"` DeliveryTime time.Time `yaml:"deliveryTime"` Message string `yaml:"message"` Session int `yaml:"session"` FromAddress string `yaml:"fromAddress"` FromCallSign string `yaml:"fromCallSign"` FromBBS string `yaml:"fromBBS"` ToBBS string `yaml:"toBBS"` Jurisdiction string `yaml:"jurisdiction"` MessageType string `yaml:"messageType"` Score int `yaml:"score"` Summary string `yaml:"summary"` Analysis string `yaml:"analysis"` }
A Message describes a single received message.
type Response ¶
type Response struct { LocalID string `yaml:"localID"` ResponseTo string `yaml:"responseTo"` To string `yaml:"to"` Subject string `yaml:"subject"` Body string `yaml:"body"` SendTime time.Time `yaml:"sendTime"` SenderCall string `yaml:"senderCall"` SenderBBS string `yaml:"senderBBS"` }
A Response is an outgoing message that responds to a received message.
type Session ¶
type Session struct { ID int `yaml:"id"` CallSign string `yaml:"callSign"` Name string `yaml:"name"` Prefix string `yaml:"prefix"` Start time.Time `yaml:"start"` End time.Time `yaml:"end"` ReportToText []string `yaml:"-"` ReportToHTML []string `yaml:"-"` ToBBSes []string `yaml:"toBBSes"` DownBBSes []string `yaml:"downBBSes"` Retrieve []*Retrieval `yaml:"retrieve"` MessageTypes []string `yaml:"messageTypes"` ModelMessage string `yaml:"modelMessage"` Instructions string `yaml:"instructions"` RetrieveAt string `yaml:"retrieveAt"` Report string `yaml:"-"` Flags SessionFlags `yaml:"flags"` ModelMsg message.Message `yaml:"-"` RetrieveInterval interval.Interval `yaml:"-"` }
A Session defines the parameters of a single session instance.
type SessionFlags ¶
type SessionFlags uint8
SessionFlags is a collection of flags describing a session.
const ( Running SessionFlags = (1 << iota) ExcludeFromWeek DontKillMessages DontSendResponses Imported Modified ReportToSenders )
Values for SessionFlags
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store gives access to the database store.
func (*Store) CreateSession ¶
CreateSession creates a new session.
func (*Store) DeleteModelImages ¶
DeleteModelImages removes all model images for the specified session.
func (*Store) DeleteSession ¶
DeleteSession deletes a session.
func (*Store) ExistSessions ¶
ExistSessions returns whether any sessions exist in the specified time range (inclusive start, exclusive end).
func (*Store) GetMessage ¶
GetMessage returns the message with the specified local ID, or nil if there is none.
func (*Store) GetMessageByHash ¶
GetMessageByHash returns the message with the specified hash, or nil if there is none.
func (*Store) GetResponses ¶
GetResponses retrieves the responses for the specified message.
func (*Store) GetRunningSessions ¶
GetRunningSessions returns the (unordered) list of all running sessions.
func (*Store) GetSession ¶
GetSession returns the session with the specified ID, or nil if there is none.
func (*Store) GetSessionMessages ¶
GetSessionMessages returns the set of messages received for the session, in the order they were delivered to the BBS at which they were received.
func (*Store) GetSessions ¶
GetSessions returns the set of sessions that end during the specified time range (inclusive start, exclusive end). The sessions are sorted by end time, then by call sign.
func (*Store) HasMessageHash ¶
HasMessageHash looks to see whether the database already contains a message with the specified hash. If so, it returns the ID of that message; if not, it returns an empty string.
func (*Store) ModelImage ¶
ModelImage returns an open file handle to the specified model image page number, or nil if there is no such image. Model image page numbers start at 1. It is the caller's responsibility to close the handle.
func (*Store) ModelImageCount ¶
ModelImageCount returns the number of model images associated with the session. The images use 1-based numbering, so they are numbered 1 through the return value of this function, inclusive.
func (*Store) NextMessageID ¶
NextMessageID returns the next message ID in the sequence with the specified prefix.
func (*Store) SaveMessage ¶
SaveMessage saves a message to the database.
func (*Store) SaveModelImage ¶
SaveModelImage saves the specified model image for the specified session.
func (*Store) SaveResponse ¶
SaveResponse saves an outgoing response to the database.
func (*Store) SessionHasMessages ¶
SessionHasMessages returns whether there are any messages stored for the specified session.
func (*Store) UpdateSession ¶
UpdateSession updates an existing session.