Documentation ¶
Index ¶
- Constants
- func ArchiveFromHashDoc(doc *HashDoc, rs RemoteStorage) (*exporter.MyArchive, error)
- func FileHashAndSize(file string) ([]byte, int64, error)
- func Hash(r io.Reader) (string, int64, error)
- func HashEntries(entries []*HashEntry) (string, error)
- type FieldReader
- type HashDoc
- func (d *HashDoc) AddFile(e *HashEntry) error
- func (d *HashDoc) IndexReader() (io.ReadCloser, error)
- func (d *HashDoc) Line() string
- func (d *HashDoc) MetadataReader() (hash string, reader io.Reader, err error)
- func (d *HashDoc) Mirror(e *HashEntry, r RemoteStorage) error
- func (d *HashDoc) ReadMetadata(fileEntry *HashEntry, r RemoteStorage) error
- func (d *HashDoc) Rehash() error
- type HashEntry
- type HashTree
- func (t *HashTree) Add(d *HashDoc) error
- func (t *HashTree) FindDoc(documentID string) (*HashDoc, error)
- func (t *HashTree) Mirror(r RemoteStorage) (changed bool, err error)
- func (t *HashTree) Rehash() error
- func (t *HashTree) Remove(documentID string) error
- func (t *HashTree) RootIndex() (io.ReadCloser, error)
- func (t *HashTree) Save(cacheFile string) error
- type MetadataFile
- type RemoteStorage
- type RemoteStorageWriter
Constants ¶
View Source
const ( DocumentType = "DocumentType" CollectionType = "CollectionType" MetadataFileExt = ".metadata" PageFileExt = ".pagedata" ContentFileExt = ".content" RmFileExt = ".rm" //ZipFileExt zip file extension ZipFileExt = ".zip" //EpubFileExt epub EpubFileExt = ".epub" //PdfFileExt pdf PdfFileExt = ".pdf" )
Variables ¶
This section is empty.
Functions ¶
func ArchiveFromHashDoc ¶
func ArchiveFromHashDoc(doc *HashDoc, rs RemoteStorage) (*exporter.MyArchive, error)
ArchiveFromHashDoc reads an archive
func HashEntries ¶
Types ¶
type FieldReader ¶
type FieldReader struct {
// contains filtered or unexported fields
}
FieldReader iterates over delimted fields
func NewFieldReader ¶
func NewFieldReader(line string) FieldReader
NewFieldReader reader from string line
type HashDoc ¶
type HashDoc struct { Files []*HashEntry HashEntry MetadataFile }
HashDoc a document in a hash tree
func NewHashDoc ¶
func NewHashDocMeta ¶
func NewHashDocMeta(documentID string, meta MetadataFile) *HashDoc
func (*HashDoc) IndexReader ¶
func (d *HashDoc) IndexReader() (io.ReadCloser, error)
IndexReader reader of the document index
func (*HashDoc) MetadataReader ¶
func (*HashDoc) Mirror ¶
func (d *HashDoc) Mirror(e *HashEntry, r RemoteStorage) error
Mirror mirror on the wall
func (*HashDoc) ReadMetadata ¶
func (d *HashDoc) ReadMetadata(fileEntry *HashEntry, r RemoteStorage) error
ReadMetadata the documentname from metadata blob
type HashTree ¶
HashTree a syncing concept for faster diffing
func BuildTree ¶
func BuildTree(provider RemoteStorage) (*HashTree, error)
BuildTree from remote storage
func (*HashTree) Mirror ¶
func (t *HashTree) Mirror(r RemoteStorage) (changed bool, err error)
Mirror makes the tree look like the storage
type MetadataFile ¶
type MetadataFile struct { DocumentName string `json:"visibleName"` CollectionType string `json:"type"` Parent string `json:"parent"` LastModified string `json:"lastModified"` LastOpened string `json:"lastOpened"` Version int `json:"version"` Pinned bool `json:"pinned"` Synced bool `json:"synced"` Modified bool `json:"modified"` Deleted bool `json:"deleted"` MetadataModified bool `json:"metadatamodified"` }
MetadataFile content
type RemoteStorage ¶
type RemoteStorage interface { GetRootIndex() (hash string, generation int64, err error) GetReader(hash string) (io.ReadCloser, error) }
RemoteStorage remote access
Click to show internal directories.
Click to hide internal directories.