Documentation ¶
Index ¶
- Constants
- Variables
- type ErrStateVersion
- type State
- func (s *State) AddChannel(info string)
- func (s *State) AddFile(channelID, fileID string, path string)
- func (s *State) AddMessage(channelID, messageTS string)
- func (s *State) AddThread(channelID, threadTS, ts string)
- func (s *State) AllFiles(channelID string) []string
- func (s *State) FileChannelID(id string) string
- func (s *State) FilePath(channelID, fileID string) string
- func (s *State) HasChannel(id string) bool
- func (s *State) HasFile(id string) bool
- func (s *State) HasThread(channelID, threadTS string) bool
- func (s *State) LatestChannelTS(id string) string
- func (s *State) LatestThreadTS(channelID, threadTS string) string
- func (st *State) OpenChunks(basePath string) (io.ReadSeekCloser, error)
- func (s *State) Save(filename string) error
- func (s *State) SaveFSA(fsa fsadapter.FS, filename string) error
- func (s *State) SetChunkFilename(filename string) *State
- func (s *State) SetFilesDir(dir string) *State
- func (s *State) SetIsComplete(isComplete bool) *State
- func (s *State) SetIsCompressed(isCompressed bool) *State
- type Stater
Constants ¶
const Version = 0.1
Variables ¶
var ErrNoChunkFile = errors.New("no linked chunk file")
Functions ¶
This section is empty.
Types ¶
type ErrStateVersion ¶
ErrStateVersion is returned when the state version does not match the expected version.
func (ErrStateVersion) Error ¶
func (e ErrStateVersion) Error() string
type State ¶
type State struct { // Version is the version of the state file. Version float64 `json:"version"` // ChunkFilename is the original chunks filename for which the state is valid. // It may be empty. ChunkFilename string `json:"chunk_filename,omitempty"` // IsComplete indicates that all chunks were written to the file. IsComplete bool `json:"is_complete"` // Directory with downloaded files, if any. FilesDir string `json:"files_dir,omitempty"` // IsCompressed indicates that the chunk file is compressed. IsCompressed bool `json:"is_compressed,omitempty"` // Channels is a map of channel ID to the latest message timestamp. Channels map[_id]int64 `json:"channels,omitempty"` // Threads is a map of channel ID + thread timestamp to the latest message // timestamp in that thread. Threads map[_idAndThread]int64 `json:"threads,omitempty"` // Files is a map of file ID to the channel ID where it was posted. Files map[_id]_id `json:"files,omitempty"` // ChannelInfos contains the list of all channels in the state file. ChannelInfos []string `json:"channel_infos,omitempty"` // contains filtered or unexported fields }
State is a struct that holds the state of the Slack dump.
func (*State) AddChannel ¶
AddChannel should be called when a channel is processed.
func (*State) AddMessage ¶
AddMessage indexes the message. It should be called when a message is processed.
func (*State) AddThread ¶
AddThread adds a thread to index. It should be called when a thread is processed.
func (*State) FileChannelID ¶
FileChannelID returns the channel ID where the file was last seen.
func (*State) HasChannel ¶
HasChannel returns true if the channel is known (has at least one message).
func (*State) LatestChannelTS ¶
LatestChannelTS returns the latest known message timestamp for the given channel.
func (*State) LatestThreadTS ¶
LatestThreadTS returns the latest known message timestamp for the given thread.
func (*State) OpenChunks ¶
func (st *State) OpenChunks(basePath string) (io.ReadSeekCloser, error)
OpenChunks attempts to open the chunk file linked in the State. If the chunk is compressed, it will be decompressed and a temporary file will be created. The temporary file will be removed when the OpenChunks is closed.