mirror of
https://github.com/zrepl/zrepl.git
synced 2025-02-17 19:01:12 +01:00
run go1.19 gofmt and make adjustments as needed
(Go 1.19 expanded doc comment syntax)
This commit is contained in:
parent
6c87bdb9fb
commit
a6aa610165
@ -44,6 +44,7 @@ func TestSampleConfigsAreParsedWithoutErrors(t *testing.T) {
|
||||
}
|
||||
|
||||
// template must be a template/text template with a single '{{ . }}' as placeholder for val
|
||||
//
|
||||
//nolint:deadcode,unused
|
||||
func testValidConfigTemplate(t *testing.T, tmpl string, val string) *Config {
|
||||
tmp, err := template.New("master").Parse(tmpl)
|
||||
|
@ -5,7 +5,7 @@
|
||||
//
|
||||
// This package also provides all supported hook type implementations and abstractions around them.
|
||||
//
|
||||
// Use For Other Kinds Of ExpectStepReports
|
||||
// # Use For Other Kinds Of ExpectStepReports
|
||||
//
|
||||
// This package REQUIRES REFACTORING before it can be used for other activities than snapshots, e.g. pre- and post-replication:
|
||||
//
|
||||
@ -15,7 +15,7 @@
|
||||
// The hook implementations should move out of this package.
|
||||
// However, there is a lot of tight coupling which to untangle isn't worth it ATM.
|
||||
//
|
||||
// How This Package Is Used By Package Snapper
|
||||
// # How This Package Is Used By Package Snapper
|
||||
//
|
||||
// Deserialize a config.List using ListFromConfig().
|
||||
// Then it MUST filter the list to only contain hooks for a particular filesystem using
|
||||
@ -30,5 +30,4 @@
|
||||
// Command hooks make it available in the environment variable ZREPL_DRYRUN.
|
||||
//
|
||||
// Plan.Report() can be called while Plan.Run() is executing to give an overview of plan execution progress (future use in "zrepl status").
|
||||
//
|
||||
package hooks
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
"github.com/zrepl/zrepl/zfs"
|
||||
)
|
||||
|
||||
// Hook to implement the following recommmendation from MySQL docs
|
||||
// https://dev.mysql.com/doc/mysql-backup-excerpt/5.7/en/backup-methods.html
|
||||
//
|
||||
// Making Backups Using a File System Snapshot:
|
||||
@ -30,6 +31,8 @@ import (
|
||||
// Unmount the snapshot.
|
||||
//
|
||||
// Similar snapshot capabilities may be available in other file systems, such as LVM or ZFS.
|
||||
//
|
||||
|
||||
type MySQLLockTables struct {
|
||||
errIsFatal bool
|
||||
connector sqldriver.Connector
|
||||
|
@ -1,6 +1,6 @@
|
||||
// package trace provides activity tracing via ctx through Tasks and Spans
|
||||
//
|
||||
// Basic Concepts
|
||||
// # Basic Concepts
|
||||
//
|
||||
// Tracing can be used to identify where a piece of code spends its time.
|
||||
//
|
||||
@ -10,11 +10,9 @@
|
||||
// to tech-savvy users (albeit not developers).
|
||||
//
|
||||
// This package provides the concept of Tasks and Spans to express what activity is happening within an application:
|
||||
//
|
||||
// - Neither task nor span is really tangible but instead contained within the context.Context tree
|
||||
// - Tasks represent concurrent activity (i.e. goroutines).
|
||||
// - Spans represent a semantic stack trace within a task.
|
||||
//
|
||||
// As a consequence, whenever a context is propagated across goroutine boundary, you need to create a child task:
|
||||
//
|
||||
// go func(ctx context.Context) {
|
||||
@ -39,6 +37,7 @@
|
||||
// }
|
||||
//
|
||||
// In combination:
|
||||
//
|
||||
// ctx, endTask = WithTask(ctx, "copy-dirs")
|
||||
// defer endTask()
|
||||
// for i := range dirs {
|
||||
@ -65,8 +64,7 @@
|
||||
//
|
||||
// Recovering from endSpan() or endTask() panics will corrupt the trace stack and lead to corrupt tracefile output.
|
||||
//
|
||||
//
|
||||
// Best Practices For Naming Tasks And Spans
|
||||
// # Best Practices For Naming Tasks And Spans
|
||||
//
|
||||
// Tasks should always have string constants as names, and must not contain the `#` character. WHy?
|
||||
// First, the visualization by chrome://tracing draws a horizontal bar for each task in the trace.
|
||||
@ -74,8 +72,7 @@
|
||||
// Note that the `#NUM` suffix will be reused if a task has ended, in order to avoid an
|
||||
// infinite number of horizontal bars in the visualization.
|
||||
//
|
||||
//
|
||||
// Chrome-compatible Tracefile Support
|
||||
// # Chrome-compatible Tracefile Support
|
||||
//
|
||||
// The activity trace generated by usage of WithTask and WithSpan can be rendered to a JSON output file
|
||||
// that can be loaded into chrome://tracing .
|
||||
|
@ -11,8 +11,6 @@ import (
|
||||
// use like this:
|
||||
//
|
||||
// defer WithSpanFromStackUpdateCtx(&existingCtx)()
|
||||
//
|
||||
//
|
||||
func WithSpanFromStackUpdateCtx(ctx *context.Context) DoneFunc {
|
||||
childSpanCtx, end := WithSpan(*ctx, getMyCallerOrPanic())
|
||||
*ctx = childSpanCtx
|
||||
|
@ -22,10 +22,8 @@
|
||||
// The fix contained in the commit this message was committed with resets the deadline whenever
|
||||
// a heartbeat is received from the server.
|
||||
//
|
||||
//
|
||||
// How to run this integration test:
|
||||
//
|
||||
//
|
||||
// Terminal 1:
|
||||
// $ ZREPL_RPC_DATACONN_HEARTBEATCONN_DEBUG=1 go run heartbeatconn_integration_variablereceiverate.go -mode server -addr 127.0.0.1:12345
|
||||
// rpc/dataconn/heartbeatconn: send heartbeat
|
||||
@ -41,8 +39,6 @@
|
||||
// rpc/dataconn/heartbeatconn: renew frameconn write timeout returned errT=<nil> err=%!s(<nil>)
|
||||
// rpc/dataconn/heartbeatconn: received heartbeat, resetting write timeout
|
||||
// ...
|
||||
//
|
||||
// You should observe
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -5,12 +5,10 @@
|
||||
// ./microbenchmark -appmode server | pv -r > /dev/null
|
||||
// ./microbenchmark -appmode client -direction recv < /dev/zero
|
||||
//
|
||||
//
|
||||
// Without the overhead of pipes (just protocol performance, mostly useful with perf bc no bw measurement)
|
||||
//
|
||||
// ./microbenchmark -appmode client -direction recv -devnoopWriter -devnoopReader
|
||||
// ./microbenchmark -appmode server -devnoopReader -devnoopWriter
|
||||
//
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -3,7 +3,7 @@
|
||||
// The zrepl documentation refers to the client as the
|
||||
// `active side` and to the server as the `passive side`.
|
||||
//
|
||||
// Design Considerations
|
||||
// # Design Considerations
|
||||
//
|
||||
// zrepl has non-standard requirements to remote procedure calls (RPC):
|
||||
// whereas the coordination of replication (the planning phase) mostly
|
||||
@ -35,7 +35,7 @@
|
||||
//
|
||||
// Hence, this package attempts to combine the best of both worlds:
|
||||
//
|
||||
// GRPC for Coordination and Dataconn for Bulk Data Transfer
|
||||
// # GRPC for Coordination and Dataconn for Bulk Data Transfer
|
||||
//
|
||||
// This package's Client uses its transport.Connecter to maintain
|
||||
// separate control and data connections to the Server.
|
||||
@ -107,8 +107,6 @@
|
||||
// | Handler |
|
||||
// +------------+
|
||||
// (usually endpoint.{Sender,Receiver})
|
||||
//
|
||||
//
|
||||
package rpc
|
||||
|
||||
// edit trick for the ASCII art above:
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
type Logger = logger.Logger
|
||||
|
||||
/// All fields must be non-nil
|
||||
// All fields must be non-nil
|
||||
type Loggers struct {
|
||||
General Logger
|
||||
Control Logger
|
||||
|
@ -9,7 +9,6 @@
|
||||
// defer a.l.Unlock().Lock()
|
||||
// fssesDone.Wait()
|
||||
// }()
|
||||
//
|
||||
package chainlock
|
||||
|
||||
import "sync"
|
||||
|
@ -28,5 +28,4 @@
|
||||
// f(Config{}) // crashes
|
||||
//
|
||||
// f Config{ CriticalSetting: &nodefault.Bool{B: false}} // doesn't crash
|
||||
//
|
||||
package nodefault
|
||||
|
@ -53,7 +53,6 @@ var componentValidChar = regexp.MustCompile(`^[0-9a-zA-Z-_\.: ]+$`)
|
||||
// characters:
|
||||
//
|
||||
// [-_.: ]
|
||||
//
|
||||
func ComponentNamecheck(datasetPathComponent string) error {
|
||||
if len(datasetPathComponent) == 0 {
|
||||
return fmt.Errorf("path component must not be empty")
|
||||
|
@ -1022,8 +1022,10 @@ func (s *DrySendInfo) unmarshalZFSOutput(output []byte) (err error) {
|
||||
}
|
||||
|
||||
// unmarshal info line, looks like this:
|
||||
//
|
||||
// full zroot/test/a@1 5389768
|
||||
// incremental zroot/test/a@1 zroot/test/a@2 5383936
|
||||
//
|
||||
// => see test cases
|
||||
func (s *DrySendInfo) unmarshalInfoLine(l string) (regexMatched bool, err error) {
|
||||
|
||||
@ -1855,7 +1857,6 @@ var ErrBookmarkCloningNotSupported = fmt.Errorf("bookmark cloning feature is not
|
||||
// unless a bookmark with the name `bookmark` exists and has the same idenitty (zfs.FilesystemVersionEqualIdentity)
|
||||
//
|
||||
// v must be validated by the caller
|
||||
//
|
||||
func ZFSBookmark(ctx context.Context, fs string, v FilesystemVersion, bookmark string) (bm FilesystemVersion, err error) {
|
||||
|
||||
bm = FilesystemVersion{
|
||||
|
Loading…
Reference in New Issue
Block a user