index

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2020 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_index_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type FolderList

type FolderList struct {
	Path      string     `json:"path"`
	Directory bool       `json:"isDir,omitempty"`
	FileId    string     `json:"fileId,omitempty"`
	Date      *time.Time `json:"date,omitempty"`
	MimeType  string     `json:"mimeType,omitempty"`
}

FolderList contains the result of the ListFolder method

type Index

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

Index manages the index for all files and folders

func (*Index) AddFile

func (i *Index) AddFile(path string, fileId []byte, mimeType string) error

AddFile adds a file to the index

func (*Index) DeleteFile

func (i *Index) DeleteFile(path string) ([]string, []string, error)

DeleteFile removes a file or folder from the index It returns the list of objects to remove as first argument, and their paths as second To remove a folder, make sure the path ends with /*

func (*Index) GetFileById added in v0.5.0

func (i *Index) GetFileById(fileId string) (*FolderList, error)

GetFileById returns the list item object for a file, searching by its id

func (*Index) GetFileByPath added in v0.5.0

func (i *Index) GetFileByPath(path string) (*FolderList, error)

GetFileByPath returns the list item object for a file, searching by its path

func (*Index) ListFolder

func (i *Index) ListFolder(path string) ([]FolderList, error)

ListFolder returns the list of elements in a folder

func (*Index) Refresh

func (i *Index) Refresh(force bool) error

Refresh an index if necessary

func (*Index) SetStore

func (i *Index) SetStore(store fs.Fs)

SetStore sets the store (filesystem) object to use

func (*Index) Stat added in v0.5.1

func (i *Index) Stat() (stats *IndexStats, err error)

Stat returns the stats for the repo, by reading the index For now, this is just the number of files

type IndexElement

type IndexElement struct {
	Path     string               `protobuf:"bytes,1,opt,name=path,json=p,proto3" json:"path,omitempty"`
	FileId   []byte               `protobuf:"bytes,2,opt,name=file_id,json=fileId,proto3" json:"file_id,omitempty"`
	Date     *timestamp.Timestamp `protobuf:"bytes,3,opt,name=date,json=d,proto3" json:"date,omitempty"`
	MimeType string               `protobuf:"bytes,4,opt,name=mime_type,json=m,proto3" json:"mime_type,omitempty"`
	// This is added for compatibility with the version 1 JSON format
	//
	// Deprecated: Do not use.
	FileIdString string `protobuf:"bytes,102,opt,name=file_id_string,json=n,proto3" json:"file_id_string,omitempty"`
	// contains filtered or unexported fields
}

IndexElement message

func (*IndexElement) Descriptor deprecated added in v0.4.0

func (*IndexElement) Descriptor() ([]byte, []int)

Deprecated: Use IndexElement.ProtoReflect.Descriptor instead.

func (*IndexElement) GetDate added in v0.4.0

func (x *IndexElement) GetDate() *timestamp.Timestamp

func (*IndexElement) GetFileId added in v0.4.0

func (x *IndexElement) GetFileId() []byte

func (*IndexElement) GetFileIdString deprecated added in v0.4.0

func (x *IndexElement) GetFileIdString() string

Deprecated: Do not use.

func (*IndexElement) GetMimeType added in v0.4.0

func (x *IndexElement) GetMimeType() string

func (*IndexElement) GetPath added in v0.4.0

func (x *IndexElement) GetPath() string

func (*IndexElement) ProtoMessage added in v0.4.0

func (*IndexElement) ProtoMessage()

func (*IndexElement) ProtoReflect added in v0.4.0

func (x *IndexElement) ProtoReflect() protoreflect.Message

func (*IndexElement) Reset added in v0.4.0

func (x *IndexElement) Reset()

func (*IndexElement) String added in v0.4.0

func (x *IndexElement) String() string

type IndexFile

type IndexFile struct {
	Version  uint32          `protobuf:"varint,1,opt,name=version,json=v,proto3" json:"version,omitempty"`
	Elements []*IndexElement `protobuf:"bytes,2,rep,name=elements,json=e,proto3" json:"elements,omitempty"`
	// contains filtered or unexported fields
}

IndexFile message

func (*IndexFile) Descriptor deprecated added in v0.4.0

func (*IndexFile) Descriptor() ([]byte, []int)

Deprecated: Use IndexFile.ProtoReflect.Descriptor instead.

func (*IndexFile) GetElements added in v0.4.0

func (x *IndexFile) GetElements() []*IndexElement

func (*IndexFile) GetVersion added in v0.4.0

func (x *IndexFile) GetVersion() uint32

func (*IndexFile) ProtoMessage added in v0.4.0

func (*IndexFile) ProtoMessage()

func (*IndexFile) ProtoReflect added in v0.4.0

func (x *IndexFile) ProtoReflect() protoreflect.Message

func (*IndexFile) Reset added in v0.4.0

func (x *IndexFile) Reset()

func (*IndexFile) String added in v0.4.0

func (x *IndexFile) String() string

type IndexStats added in v0.5.1

type IndexStats struct {
	// Number of files in the repo
	FileCount int
}

IndexStats contains the result of the

type IndexTreeNode added in v0.5.0

type IndexTreeNode struct {
	Name     string
	File     *IndexElement
	Children []*IndexTreeNode
}

IndexTreeNode is a node in the tree

func (*IndexTreeNode) Add added in v0.5.0

func (n *IndexTreeNode) Add(name string, file *IndexElement) *IndexTreeNode

Add a new child node file can be empty if adding a folder

func (*IndexTreeNode) Find added in v0.5.0

func (n *IndexTreeNode) Find(name string) *IndexTreeNode

Find returns the child node with the given name

Jump to

Keyboard shortcuts

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