Documentation
¶
Overview ¶
Package source provides archive readers for different output formats.
Currently, the following formats are supported:
- archive
- Slack Export
- dump
Index ¶
- Variables
- type ChunkDir
- func (c *ChunkDir) AllMessages(channelID string) ([]slack.Message, error)
- func (c *ChunkDir) AllThreadMessages(channelID, threadID string) ([]slack.Message, error)
- func (c *ChunkDir) ChannelInfo(_ context.Context, channelID string) (*slack.Channel, error)
- func (c *ChunkDir) Channels(ctx context.Context) ([]slack.Channel, error)
- func (c *ChunkDir) Close() error
- func (c *ChunkDir) Latest(ctx context.Context) (map[structures.SlackLink]time.Time, error)
- func (c *ChunkDir) Name() string
- func (c *ChunkDir) Type() string
- func (c *ChunkDir) Users() ([]slack.User, error)
- func (c *ChunkDir) WorkspaceInfo() (*slack.AuthTestResponse, error)
- type Dump
- func (d Dump) AllMessages(channelID string) ([]slack.Message, error)
- func (d Dump) AllThreadMessages(channelID, threadID string) ([]slack.Message, error)
- func (d Dump) ChannelInfo(_ context.Context, channelID string) (*slack.Channel, error)
- func (d Dump) Channels(context.Context) ([]slack.Channel, error)
- func (d Dump) Close() error
- func (d Dump) Latest(ctx context.Context) (map[structures.SlackLink]time.Time, error)
- func (d Dump) Name() string
- func (d Dump) Type() string
- func (d Dump) Users() ([]slack.User, error)
- func (d Dump) WorkspaceInfo() (*slack.AuthTestResponse, error)
- type Export
- func (e *Export) AllMessages(channelID string) ([]slack.Message, error)
- func (e *Export) AllThreadMessages(channelID, threadID string) ([]slack.Message, error)
- func (e *Export) ChannelInfo(ctx context.Context, channelID string) (*slack.Channel, error)
- func (e *Export) Channels(context.Context) ([]slack.Channel, error)
- func (e *Export) Close() error
- func (e *Export) Latest(ctx context.Context) (map[structures.SlackLink]time.Time, error)
- func (e *Export) Name() string
- func (e *Export) Type() string
- func (e *Export) Users() ([]slack.User, error)
- func (e *Export) WorkspaceInfo() (*slack.AuthTestResponse, error)
- type Flags
- type STDump
- type STMattermost
- type STStandard
- type Sourcer
- type Storage
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = errors.New("feature not supported")
var ErrUnknownLinkType = errors.New("unknown link type")
Functions ¶
This section is empty.
Types ¶
type ChunkDir ¶
type ChunkDir struct { Storage // contains filtered or unexported fields }
ChunkDir is the chunk directory source.
TODO: create an index of entries, otherwise it does the full scan of the directory.
func NewChunkDir ¶
NewChunkDir creates a new ChurkDir source. It expects the attachments to be in the mattermost storage format. If the attachments are not in the mattermost storage format, it will assume they were not downloaded.
func (*ChunkDir) AllMessages ¶
AllMessages returns all messages for the channel. Current restriction - it expects for all messages for the requested file to be in the file ID.json.gz. If messages for the channel are scattered across multiple file, it will not return all of them.
func (*ChunkDir) AllThreadMessages ¶
func (*ChunkDir) ChannelInfo ¶
func (*ChunkDir) WorkspaceInfo ¶ added in v3.0.6
func (c *ChunkDir) WorkspaceInfo() (*slack.AuthTestResponse, error)
type Dump ¶
type Dump struct { Storage // contains filtered or unexported fields }
func (Dump) AllThreadMessages ¶
func (Dump) ChannelInfo ¶
func (Dump) WorkspaceInfo ¶ added in v3.0.6
func (d Dump) WorkspaceInfo() (*slack.AuthTestResponse, error)
type Export ¶
type Export struct { Storage // contains filtered or unexported fields }
Export implements viewer.Sourcer for the zip file Slack export format.
func (*Export) AllMessages ¶
AllMessages returns all channel messages without thread messages.
func (*Export) AllThreadMessages ¶
func (*Export) ChannelInfo ¶
func (*Export) WorkspaceInfo ¶ added in v3.0.6
func (e *Export) WorkspaceInfo() (*slack.AuthTestResponse, error)
type STDump ¶
type STDump struct {
// contains filtered or unexported fields
}
STDump is the Storage for the dump format. Files are stored in the directories named after the channel IDs.
Directory structure:
./ +-- <channel_id1>/ | +-- <file_id1>-filename.ext | +-- <file_id2>-otherfile.ext | +-- ... +-- <channel_id1>.json +-- <channel_id2>/ | +-- <file_id3>-filename.ext | +-- <file_id4>-otherfile.ext | +-- ... +-- <channel_id2>.json +-- ...
func NewDumpStorage ¶
NewDumpStorage returns the file storage of the slackdumpdump format. fsys is the root of the dump.
type STMattermost ¶
type STMattermost struct {
// contains filtered or unexported fields
}
STMattermost is the Storage for the mattermost export format. Files are stored in the __uploads subdirectory, and the Storage is the filesystem of the __uploads directory.
Directory structure:
./__uploads/ +-- <file_id1>/filename.ext +-- <file_id2>/otherfile.ext +-- ...
func NewMattermostStorage ¶
func NewMattermostStorage(rootfs fs.FS) (*STMattermost, error)
NewMattermostStorage returns the resolver for the mattermost export format. rootfs is the root filesystem of the export.
func (*STMattermost) FS ¶
func (r *STMattermost) FS() fs.FS
type STStandard ¶
type STStandard struct {
// contains filtered or unexported fields
}
STStandard is the Storage for the standard export format. Files are stored in the "attachments" subdirectories, and the Storage is the filesystem of the export.
Directory structure:
./ +-- <channel_name>/ | +-- attachments/<file_id1>-filename.ext | +-- attachments/<file_id2>-otherfile.ext | +-- ... +-- ...
func NewStandardStorage ¶
func NewStandardStorage(rootfs fs.FS, idx map[string]string) *STStandard
func (*STStandard) FS ¶
func (r *STStandard) FS() fs.FS
type Sourcer ¶
type Sourcer interface { // Name should return the name of the retriever underlying media, i.e. // directory or archive. Name() string // Type should return the type of the retriever, i.e. "chunk" or "export". Type() string // Channels should return all channels. Channels(ctx context.Context) ([]slack.Channel, error) // Users should return all users. Users() ([]slack.User, error) // AllMessages should return all messages for the given channel id. AllMessages(channelID string) ([]slack.Message, error) // AllThreadMessages should return all messages for the given tuple // (channelID, threadID). AllThreadMessages(channelID, threadID string) ([]slack.Message, error) // ChannelInfo should return the channel information for the given channel // id. ChannelInfo(ctx context.Context, channelID string) (*slack.Channel, error) // FS should return the filesystem with file attachments. FS() fs.FS // File should return the path of the file within the filesystem returned // by FS(). File(fileID string, filename string) (string, error) // Latest should return the latest timestamp of the data. Latest(ctx context.Context) (map[structures.SlackLink]time.Time, error) // WorkspaceInfo should return the workspace information, if it is available. // If the call is not supported, it should return ErrNotSupported. WorkspaceInfo() (*slack.AuthTestResponse, error) io.Closer }
Sourcer is an interface for retrieving data from different sources.