Documentation
¶
Index ¶
- Constants
- Variables
- func NewThreadSkipper(conn *sqlx.DB) func(ctx context.Context, channelID, threadTS string, replyCount int) bool
- type DBP
- func (d *DBP) Abort() error
- func (d *DBP) Close() error
- func (d *DBP) Encode(ctx context.Context, ch *chunk.Chunk) error
- func (d *DBP) Finish() error
- func (d *DBP) InsertChunk(ctx context.Context, ch *chunk.Chunk) (int64, error)
- func (d *DBP) IsComplete(ctx context.Context, channelID string) (bool, error)
- func (d *DBP) IsCompleteThread(ctx context.Context, channelID, threadID string) (bool, error)
- func (d *DBP) Source() *Source
- func (d *DBP) String() string
- func (d *DBP) UnsafeInsertChunk(ctx context.Context, txx repository.PrepareExtContext, ch *chunk.Chunk) (int64, error)
- type ErrInvalidPayload
- type Option
- type RWSource
- type SessionInfo
- type Source
- func (s *Source) Alias(id string) (string, bool, error)
- func (s *Source) Aliases() (map[string]string, error)
- func (s *Source) AllMessages(ctx context.Context, channelID string) (iter.Seq2[slack.Message, error], error)
- func (s *Source) AllThreadMessages(ctx context.Context, channelID, threadID string) (iter.Seq2[slack.Message, error], error)
- func (s *Source) ChannelInfo(ctx context.Context, channelID string) (*slack.Channel, error)
- func (s *Source) Channels(ctx context.Context) ([]slack.Channel, error)
- func (s *Source) Close() error
- func (s *Source) Latest(ctx context.Context) (map[structures.SlackLink]time.Time, error)
- func (src *Source) Sessions(ctx context.Context) ([]repository.Session, error)
- func (s *Source) Sorted(ctx context.Context, channelID string, desc bool, ...) error
- func (src *Source) ToChunk(ctx context.Context, e chunk.Encoder, sessID int64) error
- func (s *Source) Users(ctx context.Context) ([]slack.User, error)
- func (s *Source) WorkspaceInfo(ctx context.Context) (*slack.AuthTestResponse, error)
Constants ¶
const DefaultDBFile = "slackdump.sqlite"
DefaultDBFile is the default database filename used when a directory is passed instead of a file path.
Variables ¶
var ( // ErrInvalidSessionID is returned when the session ID is invalid. ErrInvalidSessionID = errors.New("invalid session ID") // ErrIncomplete is returned when the session is incomplete. ErrIncomplete = errors.New("incomplete session") )
var ErrIsDirectory = fmt.Errorf("path is a directory")
ErrIsDirectory is returned when a directory path is passed instead of a database file.
Functions ¶
func NewThreadSkipper ¶ added in v4.4.0
func NewThreadSkipper(conn *sqlx.DB) func(ctx context.Context, channelID, threadTS string, replyCount int) bool
NewThreadSkipper returns a predicate suitable for stream.OptSkipThreadFunc. It returns true (skip) when the DB already holds replyCount+1 messages for the thread (parent message included), meaning the thread appears complete. Returns false on any error so that the thread is re-fetched safely.
CountThread is used (not CountThreadOnlyParts) intentionally: for resume we want to count messages across all sessions, so a thread fully stored in any prior session will be skipped correctly.
Note: replyCount comes from the Slack API reply_count field on the parent message, which may lag behind true thread state (edits/deletes not reflected). This is the accepted tradeoff documented in the -skip-complete-threads flag.
Types ¶
type DBP ¶
type DBP struct {
// contains filtered or unexported fields
}
DBP is the database processor.
func (*DBP) Abort ¶ added in v4.3.0
Abort closes the writer without finalising the session. No additional cleanup is required here because DBP does not own the database connection.
func (*DBP) InsertChunk ¶
InsertChunk inserts a chunk into the database.
func (*DBP) IsComplete ¶
IsComplete returns true if the channel messages have been processed (there are no unfinished threads, and all messages were received).
func (*DBP) IsCompleteThread ¶
IsCompleteThread checks that thread with channelID and threadID is complete for thread-only archives. It returns true if there are no unfinished parts of the thread. It returns false if the thread is not found. It will return false on non-thread-only archives.
func (*DBP) UnsafeInsertChunk ¶
func (d *DBP) UnsafeInsertChunk(ctx context.Context, txx repository.PrepareExtContext, ch *chunk.Chunk) (int64, error)
UnsafeInsertChunk does not lock the DBP and does not commit the transaction. It should be used for bulk inserts. Unsafe for concurrent use.
type ErrInvalidPayload ¶
func (*ErrInvalidPayload) Error ¶
func (e *ErrInvalidPayload) Error() string
type RWSource ¶ added in v4.1.1
type RWSource struct {
*Source
}
RWSource wraps Source with alias write operations. It satisfies the viewer Aliaser interface together with the read methods promoted from the embedded Source.
func OpenRW ¶ added in v4.1.1
OpenRW attempts to open the database at given path for reading and writing. Use Open when only read access is needed.
func (*RWSource) DeleteAlias ¶ added in v4.1.1
type SessionInfo ¶
type SessionInfo struct {
FromTS *time.Time
ToTS *time.Time
FilesEnabled bool
AvatarsEnabled bool
Mode string
Args string
}
SessionInfo is the information about the session to be logged in the database.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
func (*Source) AllMessages ¶
func (*Source) AllThreadMessages ¶
func (*Source) ChannelInfo ¶
func (*Source) Channels ¶
Channels returns all channels. If the channel info is not available, it will attempt to get all channels.
func (*Source) Close ¶
Close closes the database connection. It is a noop if the Source was created with [Connect].
func (*Source) WorkspaceInfo ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
mock_repository
Package mock_repository is a generated GoMock package.
|
Package mock_repository is a generated GoMock package. |