dropbox

package
v0.0.0-...-da15ff6 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPageToIndexIfNotExists

func AddPageToIndexIfNotExists(pageName string) error

All this does is add page to index.

func AddUserToIndex

func AddUserToIndex(accountId string) error

Add user to index.

func CheckUserInitialized

func CheckUserInitialized(accountId string) (bool, error)

func GetPageData

func GetPageData(pageName string) (string, error)

func GetPageFromShards

func GetPageFromShards(shards []PageShard) (string, error)

func InitializeUser

func InitializeUser(token string, accountId string) error

func PageDataHash

func PageDataHash(text string) string

func PageEditToBytes

func PageEditToBytes(edit PageEdit) ([]byte, error)

Turns one page edit into a byte array.

func PageEditsToBytes

func PageEditsToBytes(edits []PageEdit) ([]byte, error)

Turns page edits into data.

func WriteStringToPageShard

func WriteStringToPageShard(
	pageName string,
	editor string,
	str string,
	hash string,
	accessToken string,
) error

Write to edit file.

Types

type DropboxError

type DropboxError struct {
	Error string `json:"error_summary"`
}

type Index

type Index struct {
	Users []string            `json:"users"`
	Pages map[string][]string `json:"pages"`
}

Encodes the information in dbpedia_index.

func GetIndex

func GetIndex() (Index, error)

Get the dbpedia_index file on the central account. Returns a map from page name -> collaborators.

type Page

type Page struct {
	Title string `json:"page_name"`
	Data  string `json:"page_data"`
}

type PageEdit

type PageEdit struct {
	PageName  string `json:"page_name"`
	Editor    string `json:"editor"`
	Timestamp string `json:"timestamp"`
	PrevHash  string `json:"prev_hash"`

	// Diff is a crushed string generated by diff_toDelta.
	Diff string `json:"diff"`
}

A page edit has a timestamp and associated diff

func BytesToPageEdits

func BytesToPageEdits(data []byte) ([]PageEdit, error)

Turns data into list of page edits.

type PageShard

type PageShard struct {
	PageName string
	Editor   string
	Edits    []PageEdit
}

A "page shard" is one editor's contribution to one page. It will have a certain number of edits.

func GetPageShards

func GetPageShards(pageName string) ([]PageShard, error)

If a page exists, return the Page. Otherwise return Page{}.

type User

type User struct {
	Id   string
	Name map[string]interface{}
}

func GetUserFromToken

func GetUserFromToken(token string, accountId string) (User, error)

Jump to

Keyboard shortcuts

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