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

Function hubNoteboxMerge

lib/hubreq.go:904–937  ·  view source on GitHub ↗

Notebox Merge

(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc)

Source from the content-addressed store, hash-verified

902
903// Notebox Merge
904func hubNoteboxMerge(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc) (err error) {
905 // Open the box
906 box, _, _, err2 := openHubNoteboxForDevice(ctx, session, req.DeviceUID, req.DeviceSN, req.ProductUID, req.DeviceEndpointID, event)
907 if err2 != nil {
908 err = err2
909 return
910 }
911
912 // Unmarshal the notefile
913 notefile, err4 := req.GetNotefile()
914 if err4 != nil {
915 err = err4
916 box.Close(ctx)
917 return
918 }
919
920 // Merge the tracked changes
921 err = box.MergeNotebox(ctx, notefile)
922 if err != nil {
923 box.Close(ctx)
924 return err
925 }
926
927 // Update the list of notefiles
928 notefiles := box.Notefiles(false)
929 for _, notefileID := range notefiles {
930 sawNotefile(session, box, notefileID)
931 }
932
933 // Done
934 box.Close(ctx)
935
936 return nil
937}
938
939// Update the tracker
940func hubNoteboxUpdateChangeTracker(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc) (err error) {

Callers 1

processRequestFunction · 0.85

Calls 6

openHubNoteboxForDeviceFunction · 0.85
sawNotefileFunction · 0.85
GetNotefileMethod · 0.80
MergeNoteboxMethod · 0.80
NotefilesMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected