Purge a deleted object's leftovers through the runtime's delete
The runtime's objects delete already purges an object's chunks, and purges them again when asked again: Purge and purgeObject ask it, and no act of their own is added. Builds: design 47 H2 §812; H-A-366 (correction)
This commit is contained in:
@@ -26,11 +26,8 @@ const (
|
||||
ObjectsGet = "mesh/objects.get"
|
||||
ObjectsList = "mesh/objects.list"
|
||||
ObjectsDelete = "mesh/objects.delete"
|
||||
// ObjectsPurge removes what a deleted object leaves behind, its chunks, from the store (H-A-366): asked with an
|
||||
// ObjectsNameRequest, answered Done.
|
||||
ObjectsPurge = "mesh/objects.purge"
|
||||
ObjectsInfo = "mesh/objects.info"
|
||||
ObjectsWatch = "mesh/objects.watch"
|
||||
ObjectsInfo = "mesh/objects.info"
|
||||
ObjectsWatch = "mesh/objects.watch"
|
||||
// ObjectsSentGet reads an object of a sender's store of sent objects by the reference a reply or an event carried
|
||||
// (design 47 G §347, §407), served under the standing grant the grants part derives from the manifests; the answer is
|
||||
// ObjectData.
|
||||
|
||||
@@ -78,10 +78,10 @@ func (o Objects) Delete(name string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Purge removes what the deleted object name left behind in the store, its chunks, through the runtime (H-A-366): a
|
||||
// bundle never opens a connection of its own for it.
|
||||
// Purge removes what the deleted object name left behind in the store, its chunks, through the runtime's delete, which
|
||||
// purges them again when asked again (H-A-366): a bundle never opens a connection of its own for it.
|
||||
func (o Objects) Purge(name string) error {
|
||||
_, err := call[buscalls.Done](buscalls.ObjectsPurge, buscalls.ObjectsNameRequest{Objects: o.local, Name: name})
|
||||
_, err := call[buscalls.Done](buscalls.ObjectsDelete, buscalls.ObjectsNameRequest{Objects: o.local, Name: name})
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ func subABundleKeepsObjectsThroughTheRuntime(t *testing.T) {
|
||||
buscalls.ObjectsGet: buscalls.ObjectData{Info: buscalls.ObjectInfo{Name: "t1.part0"}, Data: []byte("hello")},
|
||||
buscalls.ObjectsList: buscalls.ObjectsListed{Objects: []buscalls.ObjectInfo{{Name: "t1.part0"}}},
|
||||
buscalls.ObjectsDelete: buscalls.Done{},
|
||||
buscalls.ObjectsPurge: buscalls.Done{},
|
||||
buscalls.ObjectsInfo: buscalls.Fill{Count: 0, MaxBytes: 20 << 30},
|
||||
}
|
||||
asked := map[string]map[string]any{}
|
||||
@@ -98,8 +97,8 @@ func subABundleKeepsObjectsThroughTheRuntime(t *testing.T) {
|
||||
t.Errorf("%s named the store %v, not its local name", method, p["objects"])
|
||||
}
|
||||
}
|
||||
if p := asked[buscalls.ObjectsPurge]; p["name"] != "t1.part0" {
|
||||
t.Errorf("purge asked %v", p)
|
||||
if p := asked[buscalls.ObjectsDelete]; p["name"] != "t1.part0" {
|
||||
t.Errorf("delete and purge asked %v", p)
|
||||
}
|
||||
if p := asked[buscalls.ObjectsPut]; p["name"] != "t1.part0" || p["data"] != "aGVsbG8=" || p["description"] != "a part" {
|
||||
t.Errorf("put asked %v", p)
|
||||
|
||||
+2
-2
@@ -170,11 +170,11 @@ export async function takeOnce(seat: string, ask: string, boundMs: number, state
|
||||
|
||||
/**
|
||||
* Remove what the deleted object `name` left behind in the object store `objects` (by its local name), its chunks,
|
||||
* through the runtime's `mesh/objects.purge` (H-A-366): the Go side's `busstate.Objects.Purge`. A bundle never opens a
|
||||
* through the runtime's `mesh/objects.delete`, which purges them again when asked again (H-A-366): the Go side's `busstate.Objects.Purge`. A bundle never opens a
|
||||
* connection of its own for it.
|
||||
*/
|
||||
export async function purgeObject(objects: string, name: string): Promise<void> {
|
||||
await boundChannel().ask("mesh/objects.purge", { objects, name });
|
||||
await boundChannel().ask("mesh/objects.delete", { objects, name });
|
||||
}
|
||||
|
||||
/** A state this module keeps (by its local name) or reads (`<module>.<name>`). */
|
||||
|
||||
+1
-1
@@ -1056,5 +1056,5 @@ async function newTest6(): Promise<void> {
|
||||
const { purgeObject } = await import("../dist/state/index.js");
|
||||
asked.length = 0;
|
||||
await purgeObject("artifacts", "pkg-1.tgz");
|
||||
assert.deepEqual(asked[0], ["mesh/objects.purge", { objects: "artifacts", name: "pkg-1.tgz" }]);
|
||||
assert.deepEqual(asked[0], ["mesh/objects.delete", { objects: "artifacts", name: "pkg-1.tgz" }]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user