indexing

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package file provides primitives to file indexing for sync operations.

Index

Constants

View Source
const INDEX_MAP_FILE_NAME = "index_map.csv"

Variables

This section is empty.

Functions

func Build

func Build(dir string) (map[string]api.File, error)

Build is used to create a map of the current files on the local desktop. The built map will be used to compare with the IndexMap to determine whether a file needs to be downloaded or updated. The map's key format is as follows: the/ancestors/of/the/file/fileName.pdf

func CreateIndexMap

func CreateIndexMap(indexMap IndexMap) error

CreateIndexMap writes the IndexMap to a csv file for which can be loaded for the next sync.

func LoadIndexMap

func LoadIndexMap(file io.Reader) (map[string]IndexMapEntry, error)

LoadIndexMap loads the IndexMap csv file back to a map of IndexMapEntry, with the key being the file Id.

Types

type IndexMap

type IndexMap struct {
	Entries []IndexMapEntry
}

IndexMap struct contains an array of IndexMapEntry. It is used to create a .csv IndexMap file for file comparison during syncs.

type IndexMapEntry

type IndexMapEntry struct {
	Id          string
	FileName    string
	LastUpdated int64
}

IndexMapEntry struct contains the file Id, name and last updated (unix). These are the data used for file comparison during syncs.

Jump to

Keyboard shortcuts

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