Documentation
¶
Overview ¶
Package node implements node related functioniality
Index ¶
- Variables
- func Initialize()
- func ReloadFromDisk(path string) (err error)
- type FormFile
- type FormFiles
- type IdxInfo
- type Indexes
- type Locker
- type Node
- func (node *Node) Delete() (err error)
- func (node *Node) FileExt() string
- func (node *Node) FilePath() string
- func (node *Node) FileReader() (reader file.ReaderAt, err error)
- func (node *Node) HasFile() bool
- func (node *Node) HasIndex(index string) bool
- func (node *Node) HasParent() bool
- func (node *Node) Index(name string) (idx index.Index, err error)
- func (node *Node) IndexPath() string
- func (node *Node) Mkdir() (err error)
- func (node *Node) Path() string
- func (node *Node) Rmdir() (err error)
- func (node *Node) Save() (err error)
- func (node *Node) SetAttributes(attr FormFile) (err error)
- func (node *Node) SetFile(file FormFile) (err error)
- func (node *Node) SetFileFormat(format string) (err error)
- func (node *Node) SetFileFromParts(p *partsList) (err error)
- func (node *Node) SetFileFromPath(path string) (err error)
- func (node *Node) SetIndexInfo(indextype string, idxinfo IdxInfo) (err error)
- func (node *Node) ToJson() (s string, err error)
- func (node *Node) Update(params map[string]string, files FormFiles) (err error)
- func (node *Node) UpdateDataTags(types string) (err error)
- func (node *Node) UpdateLinkages(ltype string, ids string, operation string) (err error)
- func (node *Node) UpdateVersion() (err error)
- type Nodes
Constants ¶
This section is empty.
Variables ¶
var DB *mgo.Collection
var (
LockMgr = NewLocker()
)
Functions ¶
func Initialize ¶
func Initialize()
func ReloadFromDisk ¶
Types ¶
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
func (*Locker) LockPartOp ¶
func (l *Locker) LockPartOp()
func (*Locker) UnlockPartOp ¶
func (l *Locker) UnlockPartOp()
type Node ¶
type Node struct {
Id string `bson:"id" json:"id"`
Version string `bson:"version" json:"version"`
File file.File `bson:"file" json:"file"`
Attributes interface{} `bson:"attributes" json:"attributes"`
Indexes Indexes `bson:"indexes" json:"indexes"`
Acl acl.Acl `bson:"acl" json:"-"`
VersionParts map[string]string `bson:"version_parts" json:"-"`
Tags []string `bson:"tags" json:"tags"`
Revisions []Node `bson:"revisions" json:"-"`
Linkages []linkage `bson:"linkage" json:"linkages"`
CreatedOn string `bson:"created_on" json:"created_on"`
LastModified string `bson:"last_modified" json:"last_modified"`
}
func CreateNodeUpload ¶
func CreateNodeUpload(u *user.User, params map[string]string, files FormFiles) (node *Node, err error)
CreateNodeUpload will create a new node from upload parameters and files.
func LoadFromDisk ¶
LoadFromDisk will load a node from disk
func LoadUnauth ¶
func (*Node) Delete ¶
Delete will delete an node and the contents on disk if it is not referenced from other nodes.
func (*Node) FilePath ¶
FilePath returns the path to the node file in the data directory. Note: this is not a reliable method of accessing the file content. Use node.FileReader to access content.
func (*Node) FileReader ¶
FileReader determines the type of file creates an appropriate file reader. Warning: do not directly attempt to create a file reader. Some node files are not compatiable will direct access.
func (*Node) Save ¶
Save updates the version, revision history, last modification time, and then saves the node to data directory and database.
func (*Node) SetAttributes ¶
SetAttributes sets attributes from json encoded file and saves node
func (*Node) SetFile ¶
SetFile moves the file from the temp upload director to the node data directory, checksums the file, and updates the node file information
func (*Node) SetFileFormat ¶
SetFileFormat sets file format and saves node
func (*Node) SetFileFromParts ¶
SetFileFromParts concatinates the file parts into the data directory, checksums the resulting file, and updates the node file information
func (*Node) SetFileFromPath ¶
SetFileFromPath sets the file path, checksums the file, and updates the node file information
func (*Node) SetIndexInfo ¶
SetIndexInfo sets index info and saves node
func (*Node) Update ¶
Update handle node modifications. Create is handled by this function as well.
Exclusive conditions: 1) regular upload - files["upload"] is set. 2) partial upload support - params["parts"] is set. 3) virtual file node - params["type"] & params["source"] are set. 4) set from local path - params["path"] is set.
All condition allow setting of attributes.
Additionally if parts has been set and there is a file in files that matches this set in the node.
func (*Node) UpdateDataTags ¶
UpdateLinkages updates the node data tags
func (*Node) UpdateLinkages ¶
UpdateLinkages updates the node linkage
func (*Node) UpdateVersion ¶
UpdateVersion updates the version of a node. The version is made up of md5 checksums of three sections of the object. For uniqueness these concatenated with the node id and checksumed to make the node version.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acl implements node acls modification and checking
|
Package acl implements node acls modification and checking |
|
Package contains Node File struct and MultiReaderAt implementation
|
Package contains Node File struct and MultiReaderAt implementation |
|
format/fasta
Package to read and write FASTA format files
|
Package to read and write FASTA format files |
|
format/fastq
Package to read and write FASTQ format files
|
Package to read and write FASTQ format files |
|
format/multi
Package to read and auto-detect format of fasta & fastq files
|
Package to read and auto-detect format of fasta & fastq files |
|
format/sam
Package to read and write SAM format files
|
Package to read and write SAM format files |
|
format/seq
Package contains interfaces for fasta & fastq & and multi packages
|
Package contains interfaces for fasta & fastq & and multi packages |
|
index
Package index contains indexers: bai, chunkrecord, record, size
|
Package index contains indexers: bai, chunkrecord, record, size |