Merge branch 'feat/47-G-fix9-recovery' into feat/47-G-join10

This commit is contained in:
2026-11-12 02:39:22 +01:00
50 changed files with 5054 additions and 1148 deletions
@@ -1,6 +1,6 @@
package main
import "nats-tools/internal/bussnap"
import "git.novox.be/novox/mesh-sdk/go/bussnap"
// The snapshot itself is bussnap's, which the keeper takes one entry's with too (design 25 § 12.3).
type (
@@ -19,8 +19,8 @@ import (
"testing"
"time"
"git.novox.be/novox/mesh-sdk/go/busarchive"
"github.com/nats-io/nats.go"
"nats-tools/internal/busarchive"
)
// manifestOf is the nats module's own definition, beside this program.
@@ -34,8 +34,8 @@ import (
"testing"
"time"
"git.novox.be/novox/mesh-sdk/go/busarchive"
"github.com/nats-io/nats.go"
"nats-tools/internal/busarchive"
)
// image is the bus's release (the manifest's server artifact names the same release in its tag).
+3 -2
View File
@@ -30,10 +30,11 @@ import (
"flag"
"fmt"
"io"
"nats-tools/internal/busarchive"
"nats-tools/internal/bussnap"
"os"
"time"
"git.novox.be/novox/mesh-sdk/go/busarchive"
"git.novox.be/novox/mesh-sdk/go/bussnap"
)
func main() {
@@ -16,8 +16,8 @@ import (
"syscall"
"time"
"git.novox.be/novox/mesh-sdk/go/busarchive"
"github.com/nats-io/nats.go"
"nats-tools/internal/busarchive"
)
// restoreChunk is what is sent at a time; the server answers each before the next goes.
+1 -1
View File
@@ -29,7 +29,7 @@ import (
"git.novox.be/novox/mesh-sdk/go/seatdef"
"git.novox.be/novox/mesh-sdk/go/views"
"nats-tools/internal/bussnap"
"git.novox.be/novox/mesh-sdk/go/bussnap"
"nats-tools/internal/keeper"
)
@@ -28,7 +28,7 @@ import (
"git.novox.be/novox/mesh-sdk/go/process"
"git.novox.be/novox/mesh-sdk/go/views"
"nats-tools/internal/bussnap"
"git.novox.be/novox/mesh-sdk/go/bussnap"
"nats-tools/internal/keeper"
)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"time"
stdio "git.novox.be/novox/mesh-sdk/go"
"nats-tools/internal/busarchive"
"git.novox.be/novox/mesh-sdk/go/busarchive"
"nats-tools/internal/keeper"
)
+16 -17
View File
@@ -19,6 +19,7 @@ import (
"git.novox.be/novox/mesh-contracts/go/seats/meshbroker"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/buscalls"
"git.novox.be/novox/mesh-sdk/go/process"
"nats-tools/internal/keeper"
@@ -30,34 +31,32 @@ import (
// snapshot-restore, snapshot-restore-cancel and snapshot-remove are acted on by the keeper at once, with no hand-over through the
// state requests. The tools bundle keeps nats_snapshots, which lists them.
// ChunkSize is at most what one chunk carries: 512 KiB.
const ChunkSize = 512 << 10
// AckWithin is how long the next chunk waits for its acknowledgement.
const AckWithin = 30 * time.Second
// The form of the chunks is mesh-sdk's (buscalls.SeatChunks, A-139): the caller receives with the same one.
const (
// ChunkSize is at most what one chunk carries: 512 KiB.
ChunkSize = buscalls.SeatChunkBytes
// AckWithin is how long the next chunk waits for its acknowledgement.
AckWithin = buscalls.SeatAckWithin
)
// callToken is the shape of the subject token a caller chooses for a send.
var callToken = regexp.MustCompile(`^[A-Za-z0-9_-]{16,64}$`)
// ChunkSubject and AckSubject are the subjects of the nth chunk of a send and of its acknowledgement.
func ChunkSubject(call string, n int64) string {
return "mesh.seat." + meshbroker.Seat + ".chunk." + meshbroker.VerbSnapshotGet + "." + call + "." + strconv.FormatInt(n, 10)
func sendOf(call string) buscalls.SeatChunks {
return buscalls.SeatChunks{Seat: meshbroker.Seat, Verb: meshbroker.VerbSnapshotGet, Call: call}
}
// ChunkSubject and AckSubject are the subjects of the nth chunk of a send and of its acknowledgement.
func ChunkSubject(call string, n int64) string { return sendOf(call).Chunk(n) }
// AckSubject is the subject the caller acknowledges the nth chunk on.
func AckSubject(call string, n int64) string {
return "mesh.seat." + meshbroker.Seat + ".ack." + meshbroker.VerbSnapshotGet + "." + call + "." + strconv.FormatInt(n, 10)
}
func AckSubject(call string, n int64) string { return sendOf(call).Ack(n) }
// AckPattern is every acknowledgement of snapshot-get.
const AckPattern = "mesh.seat.mesh-broker.ack.snapshot-get.*.*"
var AckPattern = buscalls.SeatAcks(meshbroker.Seat, meshbroker.VerbSnapshotGet)
// Chunk is the body of one chunk: its number, how many there are, and its bytes.
type Chunk struct {
N int64 `json:"n"`
Of int64 `json:"of"`
Data []byte `json:"data"`
}
type Chunk = buscalls.SeatChunk
// snapshotWorld is what the keeper's snapshot verbs reach: the file, the process's own publish and subscription, and the bus's users.
type snapshotWorld struct {