MCPcopy Create free account
hub / github.com/MG-RAST/Shock / initParts

Method initParts

shock-server/node/parts.go:26–52  ·  view source on GitHub ↗
(partsCount string, compressionFormat string)

Source from the content-addressed store, hash-verified

24}
25
26func (node *Node) initParts(partsCount string, compressionFormat string) (err error) {
27 // Function should only be called with a postive integer or string 'unknown'
28 count, cerr := strconv.Atoi(partsCount)
29 if partsCount != "unknown" && cerr != nil {
30 return cerr
31 }
32 if err = os.MkdirAll(fmt.Sprintf("%s/parts", node.Path()), 0777); err != nil {
33 return err
34 }
35
36 varlen := false
37 if partsCount == "unknown" {
38 count = 0
39 varlen = true
40 }
41
42 node.Type = "parts"
43 node.Parts = &PartsList{
44 Count: count,
45 Length: 0,
46 VarLen: varlen,
47 Parts: make([]partsFile, count),
48 Compression: compressionFormat,
49 }
50
51 return
52}
53
54func (node *Node) addVirtualParts(ids []string) (err error) {
55 nodes := Nodes{}

Callers 1

UpdateMethod · 0.95

Calls 1

PathMethod · 0.95

Tested by

no test coverage detected