{"modulePath":"github.com/MG-RAST/SHock","version":"v0.9.29","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package node\n\n## Variables\n\n```go\nvar DocumentMaxByte = 16777216\n```\nmongodb has hard limit of 16 MB docuemnt size\n\n## Functions\n\n```go\nfunc AsyncIndexer(idxType string, nid string, colNum int, ctx context.Context)\n```\n\n```go\nfunc DbFindDistinct(q bson.M, d string) (results interface{}, err error)\n```\n\n```go\nfunc HasAttributeField(a string) bool\n```\n\n```go\nfunc InitReaper()\n```\n\n```go\nfunc Initialize()\n```\nInitialize creates a copy of the mongodb connection and then uses that connection to create the Nodes collection in mongodb. Then, it ensures that there is a unique index on the id key in this collection, creating the index if necessary.\n\n```go\nfunc IsInMappy(item string, mp mappy) bool\n```\n\n```go\nfunc ReloadFromDisk(path string) (err error)\n```\n\n```go\nfunc SetFileFromParts(id string, compress string, numParts int, allowEmpty bool)\n```\nthis runs asynchronously and uses FileLockMgr\n\n```go\nfunc SortByteArray(b []byte) []byte\n```\n\n## Types\n\n```go\ntype IdxInfo struct {\n\tType        string           `bson:\"index_type\" json:\"-\"`\n\tTotalUnits  int64            `bson:\"total_units\" json:\"total_units\"`\n\tAvgUnitSize int64            `bson:\"average_unit_size\" json:\"average_unit_size\"`\n\tFormat      string           `bson:\"format\" json:\"-\"`\n\tCreatedOn   time.Time        `bson:\"created_on\" json:\"created_on\"`\n\tLocked      *locker.LockInfo `bson:\"-\" json:\"locked\"`\n}\n```\n\n```go\ntype Indexes map[string]*IdxInfo\n```\n\n```go\ntype Node struct {\n\tId           string            `bson:\"id\" json:\"id\"`\n\tVersion      string            `bson:\"version\" json:\"version\"`\n\tFile         file.File         `bson:\"file\" json:\"file\"`\n\tAttributes   interface{}       `bson:\"attributes\" json:\"attributes\"`\n\tIndexes      Indexes           `bson:\"indexes\" json:\"indexes\"`\n\tAcl          acl.Acl           `bson:\"acl\" json:\"-\"`\n\tVersionParts map[string]string `bson:\"version_parts\" json:\"version_parts\"`\n\tTags         []string          `bson:\"tags\" json:\"tags\"`\n\tRevisions    []Node            `bson:\"revisions\" json:\"-\"`\n\tLinkages     []linkage         `bson:\"linkage\" json:\"linkage\"`\n\tPriority     int               `bson:\"priority\" json:\"priority\"`\n\tCreatedOn    time.Time         `bson:\"created_on\" json:\"created_on\"`\n\tLastModified time.Time         `bson:\"last_modified\" json:\"last_modified\"`\n\tExpiration   time.Time         `bson:\"expiration\" json:\"expiration\"` // 0 means no expiration\n\tType         string            `bson:\"type\" json:\"type\"`\n\tSubset       Subset            `bson:\"subset\" json:\"-\"`\n\tParts        *PartsList        `bson:\"parts\" json:\"parts\"`\n}\n```\n\n```go\nfunc CreateNodeUpload(u *user.User, params map[string]string, files file.FormFiles) (node *Node, err error)\n```\n\n```go\nfunc CreateNodesFromArchive(u *user.User, params map[string]string, files file.FormFiles, archiveId string) (nodes []*Node, err error)\n```\n\n```go\nfunc Load(id string) (n *Node, err error)\n```\n\n```go\nfunc New() (node *Node)\n```\n\n```go\nfunc (node *Node) DBInit()\n```\n\n```go\nfunc (node *Node) Delete() (err error)\n```\n\n```go\nfunc (node *Node) DeleteIndex(indextype string) (err error)\n```\n\n```go\nfunc (node *Node) DynamicIndex(name string) (idx index.Index, err error)\n```\n\n```go\nfunc (node *Node) FileExt() string\n```\n\n```go\nfunc (node *Node) FilePath() string\n```\n\n```go\nfunc (node *Node) FileReader() (reader file.ReaderAt, err error)\n```\n\n```go\nfunc (node *Node) HasFile() bool\n```\nhas\n\n```go\nfunc (node *Node) HasFileLock() bool\n```\n\n```go\nfunc (node *Node) HasIndex(index string) bool\n```\n\n```go\nfunc (node *Node) HasIndexLock(name string) bool\n```\n\n```go\nfunc (node *Node) HasParent() bool\n```\n\n```go\nfunc (node *Node) IndexPath() string\n```\n\n```go\nfunc (node *Node) Mkdir() (err error)\n```\n\n```go\nfunc (node *Node) Path() string\n```\npath\n\n```go\nfunc (node *Node) Rmdir() (err error)\n```\n\n```go\nfunc (node *Node) Save() (err error)\n```\n\n```go\nfunc (node *Node) SetAttributes(attr file.FormFile) (err error)\n```\n\n```go\nfunc (node *Node) SetAttributesFromString(attributes string) (err error)\n```\n\n```go\nfunc (node *Node) SetExpiration(expire string) (err error)\n```\n\n```go\nfunc (node *Node) SetFile(file file.FormFile) (err error)\n```\n\n```go\nfunc (node *Node) SetFileFromPath(path string, action string) (err error)\n```\n\n```go\nfunc (node *Node) SetFileFromSubset(subsetIndices file.FormFile) (err error)\n```\n\n```go\nfunc (node *Node) SetIndexInfo(indextype string, idxinfo *IdxInfo)\n```\n\n```go\nfunc (node *Node) ToJson() (s string, err error)\n```\n\n```go\nfunc (node *Node) Update(params map[string]string, files file.FormFiles, hasLock bool) (err error)\n```\nModification functions\n\n```go\nfunc (node *Node) UpdateDataTags(types string)\n```\n\n```go\nfunc (node *Node) UpdateLinkages(ltype string, ids string, operation string)\n```\n\n```go\nfunc (node *Node) UpdateVersion() (err error)\n```\n\n```go\ntype NodeReaper struct{}\n```\n\n```go\nvar (\n\tTtl         *NodeReaper\n\tExpireRegex = regexp.MustCompile(`^(\\d+)(M|H|D)$`)\n)\n```\n\n```go\nfunc NewNodeReaper() *NodeReaper\n```\n\n```go\nfunc (nr *NodeReaper) Handle()\n```\n\n```go\ntype Nodes []*Node\n```\nNode array type\n\n```go\nfunc LoadNodes(ids []string) (n Nodes, err error)\n```\n\n```go\nfunc (n *Nodes) DBInit()\n```\n\n```go\nfunc (n *Nodes) GetAll(q bson.M) (err error)\n```\n\n```go\nfunc (n *Nodes) GetPaginated(q bson.M, limit int, offset int, order string) (count int, err error)\n```\n\n```go\ntype Parent struct {\n\tId        string `bson:\"id\" json:\"-\"`\n\tIndexName string `bson:\"index_name\" json:\"-\"`\n}\n```\n\n```go\ntype PartsList struct {\n\tCount       int         `bson:\"count\" json:\"count\"`\n\tLength      int         `bson:\"length\" json:\"length\"`\n\tVarLen      bool        `bson:\"varlen\" json:\"varlen\"`\n\tParts       []partsFile `bson:\"parts\" json:\"parts\"`\n\tCompression string      `bson:\"compression\" json:\"compression\"`\n}\n```\n\n```go\ntype Subset struct {\n\tParent Parent            `bson:\"parent\" json:\"-\"`\n\tIndex  SubsetNodeIdxInfo `bson:\"index\" json:\"-\"`\n}\n```\nSubset is used to store information about a subset node's parent and its index. A subset node's index defines the subset of the data file that this node represents. A subset node's index is immutable after it is defined.\n\n```go\ntype SubsetNodeIdxInfo struct {\n\tPath        string `bson:\"path\" json:\"-\"`\n\tTotalUnits  int64  `bson:\"total_units\" json:\"-\"`\n\tAvgUnitSize int64  `bson:\"average_unit_size\" json:\"-\"`\n\tFormat      string `bson:\"format\" json:\"-\"`\n}\n```\n\n","path":"github.com/MG-RAST/SHock/shock-server/node","name":"node","synopsis":"","isRedistributable":true}
