Documentation ¶
Overview ¶
Package index provides ready-to-use tables and DAOs for storing hierarchical data using the nested sets pattern
- Copyright (c) 2019-2021. Abstrium SAS <team (at) pydio.com>
- This file is part of Pydio Cells. *
- Pydio Cells is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- Pydio Cells is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details. *
- You should have received a copy of the GNU Affero General Public License
- along with Pydio Cells. If not, see <http://www.gnu.org/licenses/>. *
- The latest code can be found at <https://pydio.com>.
Index ¶
- func NewDAO(o dao.DAO, rootNodeId string) dao.DAO
- func NewNode(treeNode tree.N, path mtree.MPath, filenames []string) *mtree.TreeNode
- func RegisterIndexLen(len int)
- type BatchSend
- type CacheDAO
- type DAO
- type DAOWrapper
- type FolderSizeCacheSQL
- func (dao *FolderSizeCacheSQL) AddNode(node *mtree.TreeNode) error
- func (dao *FolderSizeCacheSQL) DelNode(node *mtree.TreeNode) error
- func (dao *FolderSizeCacheSQL) GetNode(path mtree.MPath) (*mtree.TreeNode, error)
- func (dao *FolderSizeCacheSQL) GetNodeByUUID(uuid string) (*mtree.TreeNode, error)
- func (dao *FolderSizeCacheSQL) GetNodeChildren(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
- func (dao *FolderSizeCacheSQL) GetNodeTree(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
- func (dao *FolderSizeCacheSQL) GetSQLDAO() sql.DAO
- func (dao *FolderSizeCacheSQL) MoveNodeTree(nodeFrom *mtree.TreeNode, nodeTo *mtree.TreeNode) error
- func (dao *FolderSizeCacheSQL) Path(strpath string, create bool, reqNode ...tree.N) (mtree.MPath, []*mtree.TreeNode, error)
- func (dao *FolderSizeCacheSQL) SetNode(node *mtree.TreeNode) error
- type HiddenFileDuplicateRemoverSQL
- type IndexSQL
- func (dao *IndexSQL) AddNode(node *mtree.TreeNode) error
- func (dao *IndexSQL) AddNodeStream(max int) (chan *mtree.TreeNode, chan error)
- func (dao *IndexSQL) CleanResourcesOnDeletion() (string, error)
- func (dao *IndexSQL) DelNode(node *mtree.TreeNode) error
- func (dao *IndexSQL) FixLostAndFound(lost LostAndFound) error
- func (dao *IndexSQL) FixRandHash2(excludes ...LostAndFound) (int64, error)
- func (dao *IndexSQL) Flatten() (string, error)
- func (dao *IndexSQL) Flush(final bool) error
- func (dao *IndexSQL) GetNode(path mtree.MPath) (*mtree.TreeNode, error)
- func (dao *IndexSQL) GetNodeByUUID(uuid string) (*mtree.TreeNode, error)
- func (dao *IndexSQL) GetNodeChild(reqPath mtree.MPath, reqName string) (*mtree.TreeNode, error)
- func (dao *IndexSQL) GetNodeChildren(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
- func (dao *IndexSQL) GetNodeChildrenCounts(path mtree.MPath, recursive bool) (int, int)
- func (dao *IndexSQL) GetNodeFirstAvailableChildIndex(reqPath mtree.MPath) (available uint64, e error)
- func (dao *IndexSQL) GetNodeLastChild(reqPath mtree.MPath) (*mtree.TreeNode, error)
- func (dao *IndexSQL) GetNodeTree(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
- func (dao *IndexSQL) GetNodes(mpathes ...mtree.MPath) chan *mtree.TreeNode
- func (dao *IndexSQL) GetSQLDAO() sql.DAO
- func (dao *IndexSQL) Init(ctx context.Context, options configx.Values) error
- func (dao *IndexSQL) LostAndFounds(ctx context.Context) (output []LostAndFound, err error)
- func (dao *IndexSQL) MoveNodeTree(nodeFrom *mtree.TreeNode, nodeTo *mtree.TreeNode) error
- func (dao *IndexSQL) Path(strpath string, create bool, reqNode ...tree.N) (mtree.MPath, []*mtree.TreeNode, error)
- func (dao *IndexSQL) ResyncDirtyEtags(rootNode *mtree.TreeNode) error
- func (dao *IndexSQL) SetNode(node *mtree.TreeNode) error
- func (dao *IndexSQL) SetNodeMeta(node *mtree.TreeNode) error
- func (dao *IndexSQL) SetNodes(etag string, deltaSize int64) sql.BatchSender
- func (dao *IndexSQL) UpdateNameInPlace(oldName, newName string, knownUuid string, knownLevel int) (int64, error)
- type LostAndFound
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterIndexLen ¶
func RegisterIndexLen(len int)
Types ¶
type BatchSend ¶
type BatchSend struct {
// contains filtered or unexported fields
}
BatchSend sql structure
type DAO ¶
type DAO interface { Path(strpath string, create bool, reqNode ...tree.N) (mtree.MPath, []*mtree.TreeNode, error) // AddNode adds a node in the tree AddNode(*mtree.TreeNode) error // SetNode updates a node, including its tree position SetNode(*mtree.TreeNode) error // SetNodeMeta Update a node metadata, without touching its tree position SetNodeMeta(*mtree.TreeNode) error // DelNode removes a node from the tree DelNode(*mtree.TreeNode) error // AddNodeStream Simple Add / Set / Delete AddNodeStream(int) (chan *mtree.TreeNode, chan error) Flush(bool) error // GetNodes Batch Add / Set / Delete GetNodes(...mtree.MPath) chan *mtree.TreeNode SetNodes(string, int64) sql.BatchSender GetNodeChildren(context.Context, mtree.MPath, ...*tree.MetaFilter) chan interface{} GetNodeTree(context.Context, mtree.MPath, ...*tree.MetaFilter) chan interface{} GetNode(mtree.MPath) (*mtree.TreeNode, error) GetNodeByUUID(string) (*mtree.TreeNode, error) GetNodeChild(mtree.MPath, string) (*mtree.TreeNode, error) GetNodeLastChild(mtree.MPath) (*mtree.TreeNode, error) GetNodeFirstAvailableChildIndex(mtree.MPath) (uint64, error) GetNodeChildrenCounts(mtree.MPath, bool) (int, int) MoveNodeTree(nodeFrom *mtree.TreeNode, nodeTo *mtree.TreeNode) error CleanResourcesOnDeletion() (string, error) LostAndFounds(context.Context) ([]LostAndFound, error) FixLostAndFound(lost LostAndFound) error FixRandHash2(excludes ...LostAndFound) (int64, error) Flatten() (string, error) UpdateNameInPlace(oldName, newName string, knownUuid string, knownLevel int) (int64, error) GetSQLDAO() sql.DAO }
DAO interface
func GetDAOCache ¶
GetDAOCache returns the cache based on the session name
func NewDAOCache ¶
NewDAOCache wraps a cache around the dao
func NewFolderSizeCacheDAO ¶
NewFolderSizeCacheDAO provides a middleware implementation of the index sql dao that removes duplicate entries of the .pydio file that have the same etag at the same level
func NewHiddenFileDuplicateRemoverDAO ¶
NewHiddenFileDuplicateRemoverDAO provides a middleware implementation of the index sql dao that removes duplicate entries of the .pydio file that have the same etag at the same level
type DAOWrapper ¶
type FolderSizeCacheSQL ¶
type FolderSizeCacheSQL struct {
DAO
}
FolderSizeCacheSQL implementation
func (*FolderSizeCacheSQL) AddNode ¶
func (dao *FolderSizeCacheSQL) AddNode(node *mtree.TreeNode) error
AddNode adds a node in the tree.
func (*FolderSizeCacheSQL) DelNode ¶
func (dao *FolderSizeCacheSQL) DelNode(node *mtree.TreeNode) error
DelNode removes a node from the tree
func (*FolderSizeCacheSQL) GetNodeByUUID ¶
func (dao *FolderSizeCacheSQL) GetNodeByUUID(uuid string) (*mtree.TreeNode, error)
GetNodeByUUID returns the node stored with the unique uuid
func (*FolderSizeCacheSQL) GetNodeChildren ¶
func (dao *FolderSizeCacheSQL) GetNodeChildren(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
GetNodeChildren List
func (*FolderSizeCacheSQL) GetNodeTree ¶
func (dao *FolderSizeCacheSQL) GetNodeTree(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
GetNodeTree List from the path
func (*FolderSizeCacheSQL) GetSQLDAO ¶
func (dao *FolderSizeCacheSQL) GetSQLDAO() sql.DAO
func (*FolderSizeCacheSQL) MoveNodeTree ¶
MoveNodeTree move all the nodes belonging to a tree by calculating the new mpathes
type HiddenFileDuplicateRemoverSQL ¶
type HiddenFileDuplicateRemoverSQL struct {
DAO
}
HiddenFileDuplicateRemoverSQL implementation
func (*HiddenFileDuplicateRemoverSQL) Flush ¶
func (dao *HiddenFileDuplicateRemoverSQL) Flush(final bool) error
Flush the database after big updates
func (*HiddenFileDuplicateRemoverSQL) GetSQLDAO ¶
func (dao *HiddenFileDuplicateRemoverSQL) GetSQLDAO() sql.DAO
type IndexSQL ¶
IndexSQL implementation
func (*IndexSQL) AddNodeStream ¶
AddNodeStream creates a channel to write to the SQL database
func (*IndexSQL) CleanResourcesOnDeletion ¶
CleanResourcesOnDeletion revert the creation of the table for a datasource
func (*IndexSQL) FixLostAndFound ¶
func (dao *IndexSQL) FixLostAndFound(lost LostAndFound) error
FixLostAndFound receives LostAndFound that are ready for deletion
func (*IndexSQL) FixRandHash2 ¶
func (dao *IndexSQL) FixRandHash2(excludes ...LostAndFound) (int64, error)
FixRandHash2 looks up for hash2 in the form 'random-%' and recompute them as proper has of parents + name
func (*IndexSQL) GetNodeByUUID ¶
GetNodeByUUID returns the node stored with the unique uuid
func (*IndexSQL) GetNodeChild ¶
GetNodeChild from node path whose name matches
func (*IndexSQL) GetNodeChildren ¶
func (dao *IndexSQL) GetNodeChildren(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
GetNodeChildren List
func (*IndexSQL) GetNodeChildrenCounts ¶
GetNodeChildrenCounts List
func (*IndexSQL) GetNodeFirstAvailableChildIndex ¶
func (dao *IndexSQL) GetNodeFirstAvailableChildIndex(reqPath mtree.MPath) (available uint64, e error)
GetNodeFirstAvailableChildIndex from path
func (*IndexSQL) GetNodeLastChild ¶
GetNodeLastChild from path
func (*IndexSQL) GetNodeTree ¶
func (dao *IndexSQL) GetNodeTree(ctx context.Context, path mtree.MPath, filter ...*tree.MetaFilter) chan interface{}
GetNodeTree List from the path
func (*IndexSQL) LostAndFounds ¶
func (dao *IndexSQL) LostAndFounds(ctx context.Context) (output []LostAndFound, err error)
func (*IndexSQL) MoveNodeTree ¶
MoveNodeTree move all the nodes belonging to a tree by calculating the new mpathes
func (*IndexSQL) ResyncDirtyEtags ¶
ResyncDirtyEtags ensures that etags are rightly calculated
func (*IndexSQL) SetNodeMeta ¶
SetNodeMeta in replacement of previous node