Documentation ¶
Index ¶
- func ArchiveFromHashDoc(doc *HashDoc, rs RemoteStorage) (*exporter.MyArchive, error)
- func FileHashAndSize(file string) ([]byte, int64, error)
- func FromTime(t time.Time) string
- func Hash(r io.Reader) (string, int64, error)
- func HashEntries(entries []*HashEntry) (string, error)
- func ToTime(timeStamp string) (t time.Time, err error)
- type ContentFile
- type ExtraMetadata
- 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
- type RootHistory
- type Transform
Constants ¶
This section is empty.
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 ContentFile ¶ added in v0.0.12
type ContentFile struct { DummyDocument bool `json:"dummyDocument"` ExtraMetadata ExtraMetadata `json:"extraMetadata"` FileType string `json:"fileType"` FontName string `json:"fontName"` LastOpenedPage int `json:"lastOpenedPage"` LineHeight int `json:"lineHeight"` Margins int `json:"margins"` Orientation string `json:"orientation"` PageCount int `json:"pageCount"` Pages []interface{} `json:"pages"` TextScale int `json:"textScale"` Transform Transform `json:"transform"` SizeInBytes string `json:"sizeInBytes"` }
type ExtraMetadata ¶ added in v0.0.12
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 //extra fields that are serialized MetadataFile PayloadType string PayloadSize int64 }
HashDoc a document in a hash tree
func NewHashDocWithMeta ¶ added in v0.0.12
func NewHashDocWithMeta(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 tries to read the metadata blob if this entry is metadata
type HashEntry ¶
HashEntry an entry in a doc (.content, .meta the payload etc) with a hash
func NewHashEntry ¶ added in v0.0.12
NewHashEntry blah
func (*HashEntry) IsMetadata ¶ added in v0.0.12
IsMetadata if this entry points to a 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 common.EntryType `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 returns the rootIndex GetRootIndex() (hash string, generation int64, err error) // GetReader returns a reader for the the blob with that hash GetReader(hash string) (io.ReadCloser, error) }
RemoteStorage abstraction for the blob storage
type RemoteStorageWriter ¶
type RemoteStorageWriter interface { WriteRootIndex(generation int64, hash string) (gen int64, err error) Write(hash string, reader io.Reader) error }
RemoteStorageWriter write abstraction
type RootHistory ¶ added in v0.0.14
func ReadRootHistory ¶ added in v0.0.14
func ReadRootHistory(filename string) (history []*RootHistory, err error)
func (*RootHistory) GetHashTree ¶ added in v0.0.14
func (h *RootHistory) GetHashTree(r RemoteStorage) (t *HashTree, err error)
func (*RootHistory) OpenIndex ¶ added in v0.0.14
func (h *RootHistory) OpenIndex(r RemoteStorage) (io.ReadCloser, error)