MCPcopy
hub / github.com/perkeep/perkeep / directoryStaticSet

Method directoryStaticSet

cmd/pk-put/files.go:358–372  ·  view source on GitHub ↗

directoryStaticSet returns the set of static-set schemas that represent the children of n. If the number of children is small (<10000), they're all members of the first (and only) static-set returned. Otherwise they are split and spread on several subsets (i.e. "mergeSets") which are all returned.

()

Source from the content-addressed store, hash-verified

356// of the first (and only) static-set returned. Otherwise they are split and spread
357// on several subsets (i.e. "mergeSets") which are all returned.
358func (n *node) directoryStaticSet() ([]*schema.Blob, error) {
359 var members []blob.Ref
360 ss := schema.NewStaticSet()
361 for _, c := range n.children {
362 pr, err := c.PutResult()
363 if err != nil {
364 return nil, fmt.Errorf("Error populating directory static set for child %q: %v", c.fullPath, err)
365 }
366 members = append(members, pr.BlobRef)
367 }
368 subsets := ss.SetStaticSetMembers(members)
369 allSets := []*schema.Blob{ss.Blob()}
370 allSets = append(allSets, subsets...)
371 return allSets, nil
372}
373
374func (up *Uploader) uploadNode(ctx context.Context, n *node) (*client.PutResult, error) {
375 fi := n.fi

Callers 1

uploadNodeMethod · 0.80

Calls 4

NewStaticSetFunction · 0.92
PutResultMethod · 0.80
SetStaticSetMembersMethod · 0.80
BlobMethod · 0.65

Tested by

no test coverage detected