MCPcopy Create free account
hub / github.com/blues/note / GetNotefile

Method GetNotefile

lib/wire.go:508–539  ·  view source on GitHub ↗

GetNotefile gets the notefile from within the a notehubMessage data structure

()

Source from the content-addressed store, hash-verified

506
507// GetNotefile gets the notefile from within the a notehubMessage data structure
508func (msg *notehubMessage) GetNotefile() (notefile *Notefile, err error) {
509 notefile = &Notefile{}
510
511 // If native is available, return it, else decompress
512 if msg.nf != nil && msg.nf.Notefile != nil {
513 notefile = msg.nf.Notefile
514 } else {
515 if msg.cf == nil || len(msg.cf.Notefile) == 0 {
516 return
517 }
518 jdata, err2 := jsonDecompress(msg.cf.Notefile)
519 if err2 != nil {
520 err = err2
521 return
522 }
523 err = note.JSONUnmarshal(jdata, notefile)
524 if err != nil {
525 return
526 }
527 }
528
529 // If there's an externalized payload, internalize it
530 if msg.nf.Payload != nil && len(*msg.nf.Payload) != 0 {
531 err = notefile.InternalizePayload(*msg.nf.Payload)
532 if err != nil {
533 return
534 }
535 }
536
537 // Done
538 return
539}
540
541// SetNotefiles sets the notefile list within the a notehubMessage data structure
542func (msg *notehubMessage) SetNotefiles(notefiles map[string]*Notefile) error {

Callers 4

hubWebRequestFunction · 0.80
hubSignalFunction · 0.80
hubNoteboxMergeFunction · 0.80
hubNotefileMergeFunction · 0.80

Calls 2

jsonDecompressFunction · 0.85
InternalizePayloadMethod · 0.80

Tested by

no test coverage detected