Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions append_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ func (o *AppendOptions) WithMirrors(mirrors WitnessGroup, opts *MirroringOptions
}

// WitnessOptions contains extra optional configuration for how Tessera should use/interact with
// a user-provided WitnessGroup policy.
// a user-provided witness policy.
type WitnessOptions struct {
// Timeout is the maximum time to wait while attempting to satisfy the configured witness policy.
//
Expand Down Expand Up @@ -1326,10 +1326,15 @@ func (o *AppendOptions) LogValue() slog.Value {
}

if len(o.witnessPolicy.Witnesses) > 0 {
seen := make(map[string]bool)
urls := make([]string, 0, len(o.witnessPolicy.Witnesses))
for _, w := range o.witnessPolicy.Witnesses {
if w.URL != nil {
urls = append(urls, w.URL.String())
u := w.URL.String()
if !seen[u] {
seen[u] = true
urls = append(urls, u)
}
}
}
attrs = append(attrs, slog.Group("witnesses",
Expand All @@ -1339,10 +1344,15 @@ func (o *AppendOptions) LogValue() slog.Value {
))
}
if len(o.mirrorPolicy.Witnesses) > 0 {
seen := make(map[string]bool)
urls := make([]string, 0, len(o.mirrorPolicy.Witnesses))
for _, w := range o.mirrorPolicy.Witnesses {
if w.URL != nil {
urls = append(urls, w.URL.String())
u := w.URL.String()
if !seen[u] {
seen[u] = true
urls = append(urls, u)
}
}
}
attrs = append(attrs, slog.Group("mirrors",
Expand Down
2 changes: 1 addition & 1 deletion cmd/examples/posix-oneshot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func main() {
}
var wPol policy.TLogPolicy
if err := wPol.Unmarshal(f); err != nil {
slog.ErrorContext(ctx, "Failed to create witness group from policy", slog.Any("error", err))
slog.ErrorContext(ctx, "Failed to parse witness policy", slog.Any("error", err))
os.Exit(1)
}

Expand Down
Loading