fourfuse

package
v0.0.0-...-eadeb79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HASH_BOARD_PREFIX            = "bo"
	HASH_THREAD_PREFIX           = "th"
	HASH_THREAD_INFO_PREFIX      = "ti"
	HASH_THREAD_DISCUSSION       = "td"
	HASH_POST_PREFIX             = "po"
	HASH_POST_INFO_PREFIX        = "pi"
	HASH_POST_IMAGE              = "pm"
	HASH_POST_THUMBNAIL          = "pt"
	HASH_POST_PREFIXED_THUMBNAIL = "pp"
	HASH_POST_COMMENT            = "pc"
	HASH_POST_SUBJECT            = "ps"
	HASH_IMAGE_DIR_PREFIX        = "id"
	HASH_POSTS_DIR_PREFIX        = "pd"
)
View Source
const EARLY_REMOTE_DOWNLOAD = true

Download remote files early on "Attr" call. This will help with file browsers that are otherwise confused with 0 size thumbnails. The posts main images are not affacted because their size is available as meta data in advance. Disable it if you do not need thumbnails.

Variables

View Source
var (
	Log *log.Logger
)

Functions

func GeneratePostSlug

func GeneratePostSlug(post *fourc.Post) string

func InitializeLogger

func InitializeLogger()

func LogDebug

func LogDebug(v ...interface{})

func LogDebugf

func LogDebugf(format string, v ...interface{})

func LogError

func LogError(v ...interface{})

func LogErrorf

func LogErrorf(format string, v ...interface{})

func LogInfo

func LogInfo(v ...interface{})

func LogInfof

func LogInfof(format string, v ...interface{})

func LogTrace

func LogTrace(v ...interface{})

func LogTracef

func LogTracef(format string, v ...interface{})

func Max

func Max(a int, b int) int

func Min

func Min(a int, b int) int

func UseSystemLocale

func UseSystemLocale()

Types

type Board

type Board struct {
	// contains filtered or unexported fields
}

func NewBoard

func NewBoard(handle string, name string) *Board

func (*Board) Attr

func (b *Board) Attr(ctx context.Context, a *fuse.Attr) error

func (*Board) GetDirent

func (b *Board) GetDirent() fuse.Dirent

func (*Board) Lookup

func (b *Board) Lookup(ctx context.Context, name string) (fs.Node, error)

func (*Board) ReadDirAll

func (b *Board) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

func (*Board) Slug

func (b *Board) Slug() string

type BoardsDir

type BoardsDir struct {
	// contains filtered or unexported fields
}

func LoadBoards

func LoadBoards() *BoardsDir

func (*BoardsDir) Attr

func (b *BoardsDir) Attr(ctx context.Context, a *fuse.Attr) error

func (*BoardsDir) Lookup

func (b *BoardsDir) Lookup(ctx context.Context, name string) (fs.Node, error)

func (*BoardsDir) ReadDirAll

func (b *BoardsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

type FS

type FS struct {
	// contains filtered or unexported fields
}

func NewFs

func NewFs(boardsDir *BoardsDir) *FS

func (FS) Root

func (fs FS) Root() (fs.Node, error)

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(inode uint64, content string) *File

func (*File) Attr

func (f *File) Attr(ctx context.Context, a *fuse.Attr) error

func (*File) ReadAll

func (f *File) ReadAll(ctx context.Context) ([]byte, error)

type FileAccessCallback

type FileAccessCallback interface {
	// contains filtered or unexported methods
}

type FileAccessCallbackNoop

type FileAccessCallbackNoop struct {
}

func NewFileAccessCallbackNoop

func NewFileAccessCallbackNoop() *FileAccessCallbackNoop

type FileCache

type FileCache struct {
	// contains filtered or unexported fields
}

func GetCache

func GetCache() *FileCache

func (*FileCache) Lookup

func (fc *FileCache) Lookup(key string) ([]byte, bool)

func (*FileCache) Store

func (fc *FileCache) Store(key string, data []byte)

type FilenameByLocale

type FilenameByLocale []*listEntry

func (FilenameByLocale) Len

func (s FilenameByLocale) Len() int

func (FilenameByLocale) Less

func (s FilenameByLocale) Less(i, j int) bool

func (FilenameByLocale) Swap

func (s FilenameByLocale) Swap(i, j int)

type HasDirent

type HasDirent interface {
	GetDirent() fuse.Dirent
}

type ImageDir

type ImageDir struct {
	// contains filtered or unexported fields
}

func NewImageDir

func NewImageDir(slug string, remoteFiles []*RemoteFile) *ImageDir

func NewImageDirFromImageList

func NewImageDirFromImageList(slug string, imageList *ImageList) *ImageDir

ImageList will be copied

func (*ImageDir) Attr

func (d *ImageDir) Attr(ctx context.Context, a *fuse.Attr) error

func (*ImageDir) GetContentDirents

func (d *ImageDir) GetContentDirents() []fuse.Dirent

func (*ImageDir) GetDirent

func (d *ImageDir) GetDirent() fuse.Dirent

func (*ImageDir) Lookup

func (d *ImageDir) Lookup(ctx context.Context, name string) (fs.Node, error)

func (*ImageDir) ReadDirAll

func (d *ImageDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

func (*ImageDir) Slug

func (d *ImageDir) Slug() string

type ImageList

type ImageList struct {
	// contains filtered or unexported fields
}

func NewImageList

func NewImageList() *ImageList

func (*ImageList) Add

func (il *ImageList) Add(files ...*RemoteFile)

func (*ImageList) Copy

func (il *ImageList) Copy() *ImageList

func (*ImageList) Get

func (il *ImageList) Get(slug string) (file *RemoteFile, present bool)

func (*ImageList) GetContentDirents

func (il *ImageList) GetContentDirents() []fuse.Dirent

func (*ImageList) GetIndex

func (il *ImageList) GetIndex(file *RemoteFile) (index int, found bool)

func (*ImageList) GetNEntriesAfter

func (il *ImageList) GetNEntriesAfter(index int, amount int) []*RemoteFile

func (*ImageList) GetNEntriesBefore

func (il *ImageList) GetNEntriesBefore(index int, amount int) []*RemoteFile

func (*ImageList) SortByLocale

func (il *ImageList) SortByLocale()

type Post

type Post struct {
	// contains filtered or unexported fields
}

func NewPost

func NewPost(fourc *fourc.Post, thread *Thread) *Post

func (*Post) Attr

func (p *Post) Attr(ctx context.Context, a *fuse.Attr) error

func (*Post) GetCommentSanitized

func (p *Post) GetCommentSanitized() string

func (*Post) GetDirent

func (p *Post) GetDirent() fuse.Dirent

func (*Post) GetImage

func (p *Post) GetImage() *RemoteFile

func (*Post) GetSamePrefixedSlugThumbnail

func (p *Post) GetSamePrefixedSlugThumbnail() *RemoteFile

func (*Post) GetSubjectSanitized

func (p *Post) GetSubjectSanitized() string

func (*Post) GetThumbnail

func (p *Post) GetThumbnail() *RemoteFile

func (*Post) GetUserName

func (p *Post) GetUserName() string

func (*Post) HasImage

func (p *Post) HasImage() bool

func (*Post) Lookup

func (p *Post) Lookup(ctx context.Context, name string) (fs.Node, error)

func (*Post) ReadDirAll

func (p *Post) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

func (*Post) Slug

func (p *Post) Slug() string

func (*Post) Time

func (p *Post) Time() time.Time

type PostPrefetch

type PostPrefetch struct {
	// contains filtered or unexported fields
}

func NewPostPrefetch

func NewPostPrefetch(imageList *ImageList) *PostPrefetch

type PostsDir

type PostsDir struct {
	// contains filtered or unexported fields
}

func NewPostsDir

func NewPostsDir(slug string, posts map[string]*Post) *PostsDir

func (*PostsDir) Attr

func (d *PostsDir) Attr(ctx context.Context, a *fuse.Attr) error

func (*PostsDir) GetDirent

func (d *PostsDir) GetDirent() fuse.Dirent

func (*PostsDir) Lookup

func (d *PostsDir) Lookup(ctx context.Context, name string) (fs.Node, error)

func (*PostsDir) ReadDirAll

func (d *PostsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

func (*PostsDir) Slug

func (d *PostsDir) Slug() string

type PrefetchWorkerPool

type PrefetchWorkerPool struct {
	// contains filtered or unexported fields
}

func GetPrefetchWorkerPool

func GetPrefetchWorkerPool() *PrefetchWorkerPool

func NewPrefetchWorkerPool

func NewPrefetchWorkerPool() *PrefetchWorkerPool

func (*PrefetchWorkerPool) Pause

func (wp *PrefetchWorkerPool) Pause()

func (*PrefetchWorkerPool) Resume

func (wp *PrefetchWorkerPool) Resume()

func (*PrefetchWorkerPool) ScheduleDownload

func (wp *PrefetchWorkerPool) ScheduleDownload(file *RemoteFile)

type RemoteFile

type RemoteFile struct {
	// contains filtered or unexported fields
}

func NewRemoteFile

func NewRemoteFile(inode uint64, slug string, url string, size uint64) *RemoteFile

func (*RemoteFile) AddPrefix

func (f *RemoteFile) AddPrefix(prefix string)

func (*RemoteFile) AddSuffix

func (f *RemoteFile) AddSuffix(suffix string)

func (*RemoteFile) Attr

func (f *RemoteFile) Attr(ctx context.Context, a *fuse.Attr) error

func (*RemoteFile) Download

func (f *RemoteFile) Download(hasPriority bool)

func (*RemoteFile) GetDirent

func (f *RemoteFile) GetDirent() fuse.Dirent

func (*RemoteFile) IsDownloaded

func (f *RemoteFile) IsDownloaded() bool

func (*RemoteFile) ReadAll

func (f *RemoteFile) ReadAll(ctx context.Context) ([]byte, error)

func (*RemoteFile) SetAccessCallback

func (f *RemoteFile) SetAccessCallback(fac FileAccessCallback)

func (*RemoteFile) Slug

func (f *RemoteFile) Slug() string

type Thread

type Thread struct {
	*Post
	// contains filtered or unexported fields
}

func NewThread

func NewThread(fourc *fourc.Thread) *Thread

func (*Thread) GetThumbnail

func (t *Thread) GetThumbnail() *RemoteFile

func (*Thread) Lookup

func (t *Thread) Lookup(ctx context.Context, name string) (fs.Node, error)

func (*Thread) ReadDirAll

func (t *Thread) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL