Documentation ¶
Overview ¶
nntp article storage
Index ¶
- Variables
- type FilesystemStorage
- func (fs FilesystemStorage) ArticleDir() string
- func (fs FilesystemStorage) AttachmentDir() string
- func (fs FilesystemStorage) DeleteArticle(msgid string) (err error)
- func (fs FilesystemStorage) Ensure() (err error)
- func (fs FilesystemStorage) ForEachInGroup(group string, chnl chan string)
- func (fs FilesystemStorage) HasArticle(msgid string) (err error)
- func (fs FilesystemStorage) OpenArticle(msgid string) (r *os.File, err error)
- func (fs FilesystemStorage) StoreArticle(r io.Reader, msgid, newsgroup string) (fpath string, err error)
- func (fs FilesystemStorage) StoreAttachment(r io.Reader, filename string) (fpath string, err error)
- func (fs FilesystemStorage) String() string
- func (fs FilesystemStorage) TempDir() string
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSuchArticle = errors.New("no such article")
Functions ¶
This section is empty.
Types ¶
type FilesystemStorage ¶
type FilesystemStorage struct {
// contains filtered or unexported fields
}
filesystem storage of nntp articles and attachments
func NewFilesytemStorage ¶
func NewFilesytemStorage(dirname string, unpackAttachments bool) (fs FilesystemStorage, err error)
create a new filesystem storage directory ensure directory and subdirectories
func (FilesystemStorage) ArticleDir ¶
func (fs FilesystemStorage) ArticleDir() string
get the directory path for articles
func (FilesystemStorage) AttachmentDir ¶
func (fs FilesystemStorage) AttachmentDir() string
get the directory path for attachments
func (FilesystemStorage) DeleteArticle ¶
func (fs FilesystemStorage) DeleteArticle(msgid string) (err error)
func (FilesystemStorage) Ensure ¶
func (fs FilesystemStorage) Ensure() (err error)
ensure the filesystem storage exists and is well formed and read/writable
func (FilesystemStorage) ForEachInGroup ¶
func (fs FilesystemStorage) ForEachInGroup(group string, chnl chan string)
func (FilesystemStorage) HasArticle ¶
func (fs FilesystemStorage) HasArticle(msgid string) (err error)
check if we have the artilce with this message id
func (FilesystemStorage) OpenArticle ¶
func (fs FilesystemStorage) OpenArticle(msgid string) (r *os.File, err error)
open article given message-id does not check validity
func (FilesystemStorage) StoreArticle ¶
func (fs FilesystemStorage) StoreArticle(r io.Reader, msgid, newsgroup string) (fpath string, err error)
store an article from a reader to disk
func (FilesystemStorage) StoreAttachment ¶
store attachment onto filesystem
func (FilesystemStorage) String ¶
func (fs FilesystemStorage) String() string
func (FilesystemStorage) TempDir ¶
func (fs FilesystemStorage) TempDir() string
get the temp file directory
type Storage ¶
type Storage interface { // store an attachment that we read from an io.Reader // filename is used to hint to store what extension to store it as // returns absolute filepath where attachment was stored and nil on success // returns emtpy string and error if an error ocurred while storing StoreAttachment(r io.Reader, filename string) (string, error) // store an article that we read from an io.Reader // message id is used to hint where the article is stored as well as newsgroup // returns absolute filepath to where the article was stored and nil on success // returns empty string and error if an error ocurred while storing StoreArticle(r io.Reader, msgid, newsgroup string) (string, error) // return nil if the article with the given message id exists in this storage // return ErrNoSuchArticle if it does not exist or an error if another error occured while checking HasArticle(msgid string) error // delete article from underlying storage DeleteArticle(msgid string) error // open article for reading OpenArticle(msgid string) (*os.File, error) // ensure the underlying storage backend is created Ensure() error // iterate over all messages in a newsgroup // send results down a channel ForEachInGroup(newsgroup string, cnhl chan string) }
storage for nntp articles and attachments
Click to show internal directories.
Click to hide internal directories.