"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "physical/raft/snapshot.go" between
vault-1.8.1.tar.gz and vault-1.8.2.tar.gz

About: vault is a tool for secrets management, encryption as a service, and privileged access management.

snapshot.go  (vault-1.8.1):snapshot.go  (vault-1.8.2)
skipping to change at line 12 skipping to change at line 12
import ( import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"math" "math"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"sync" "sync"
"time" "time"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
log "github.com/hashicorp/go-hclog" log "github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/sdk/plugin/pb" "github.com/hashicorp/vault/sdk/plugin/pb"
"github.com/rboyer/safeio" "github.com/rboyer/safeio"
bolt "go.etcd.io/bbolt" bolt "go.etcd.io/bbolt"
"go.uber.org/atomic" "go.uber.org/atomic"
skipping to change at line 459 skipping to change at line 460
if s.writeError != nil { if s.writeError != nil {
// If we encountered an error while writing then we shoul d remove // If we encountered an error while writing then we shoul d remove
// the directory and return the error // the directory and return the error
_ = os.RemoveAll(s.dir) _ = os.RemoveAll(s.dir)
return s.writeError return s.writeError
} }
// Move the directory into place // Move the directory into place
newPath := strings.TrimSuffix(s.dir, tmpSuffix) newPath := strings.TrimSuffix(s.dir, tmpSuffix)
if err := safeio.Rename(s.dir, newPath); err != nil {
var err error
if runtime.GOOS != "windows" {
err = safeio.Rename(s.dir, newPath)
} else {
err = os.Rename(s.dir, newPath)
}
if err != nil {
s.logger.Error("failed to move snapshot into place", "err or", err) s.logger.Error("failed to move snapshot into place", "err or", err)
return err return err
} }
} }
return nil return nil
} }
// Cancel is used to indicate an unsuccessful end. // Cancel is used to indicate an unsuccessful end.
func (s *BoltSnapshotSink) Cancel() error { func (s *BoltSnapshotSink) Cancel() error {
skipping to change at line 514 skipping to change at line 523
func (i *boltSnapshotInstaller) Install(filename string) error { func (i *boltSnapshotInstaller) Install(filename string) error {
if len(i.filename) == 0 { if len(i.filename) == 0 {
return errors.New("snapshot filename empty") return errors.New("snapshot filename empty")
} }
if len(filename) == 0 { if len(filename) == 0 {
return errors.New("fsm filename empty") return errors.New("fsm filename empty")
} }
// Rename the snapshot to the FSM location // Rename the snapshot to the FSM location
return safeio.Rename(i.filename, filename) if runtime.GOOS != "windows" {
return safeio.Rename(i.filename, filename)
} else {
return os.Rename(i.filename, filename)
}
} }
// snapshotName generates a name for the snapshot. // snapshotName generates a name for the snapshot.
func snapshotName(term, index uint64) string { func snapshotName(term, index uint64) string {
now := time.Now() now := time.Now()
msec := now.UnixNano() / int64(time.Millisecond) msec := now.UnixNano() / int64(time.Millisecond)
return fmt.Sprintf("%d-%d-%d", term, index, msec) return fmt.Sprintf("%d-%d-%d", term, index, msec)
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)