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

Function hubNotefileDeleteNote

lib/hubreq.go:1308–1338  ·  view source on GitHub ↗

Notefile DeleteNote

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

Source from the content-addressed store, hash-verified

1306
1307// Notefile DeleteNote
1308func hubNotefileDeleteNote(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc) (err error) {
1309 // Open the box
1310 box, ei, _, err2 := openHubNoteboxForDevice(ctx, session, req.DeviceUID, req.DeviceSN, req.ProductUID, req.DeviceEndpointID, event)
1311 if err2 != nil {
1312 err = err2
1313 return
1314 }
1315
1316 // Open the specified notefile
1317 openfile, file, err4 := box.OpenNotefile(ctx, req.NotefileID)
1318 if err4 != nil {
1319 err = err4
1320 box.Close(ctx)
1321 return
1322 }
1323 sawNotefile(session, box, req.NotefileID)
1324
1325 // Perform the operation
1326 err = file.DeleteNote(ctx, ei, req.DeviceEndpointID, req.NoteID)
1327 if err != nil {
1328 openfile.Close(ctx)
1329 box.Close(ctx)
1330 return err
1331 }
1332
1333 // Done
1334 openfile.Close(ctx)
1335 box.Close(ctx)
1336
1337 return nil
1338}
1339
1340// Notefile UpdateNote
1341func hubNotefileUpdateNote(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc) (err error) {

Callers 1

processRequestFunction · 0.85

Calls 5

openHubNoteboxForDeviceFunction · 0.85
sawNotefileFunction · 0.85
OpenNotefileMethod · 0.80
CloseMethod · 0.45
DeleteNoteMethod · 0.45

Tested by

no test coverage detected