vendor: update vendored upspin.io to 93ca68f
Change-Id: I722c0754010b1701c47b4e147feef736912a10ec
Reviewed-on: https://upspin-review.googlesource.com/17502
Reviewed-by: Rob Pike <r@golang.org>
diff --git a/Gopkg.lock b/Gopkg.lock
index c8cb629..ee5954f 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -59,7 +59,7 @@
branch = "master"
name = "upspin.io"
packages = ["access","bind","cache","client","client/clientutil","client/file","cloud/mail","cmd/cacheserver/cacheutil","config","dir/inprocess","dir/remote","dir/unassigned","errors","factotum","flags","key/inprocess","key/keygen","key/proquint","key/remote","key/sha256key","key/transports","key/unassigned","key/usercache","log","metric","pack","pack/ee","pack/eeintegrity","pack/internal","pack/packutil","pack/plain","path","rpc","rpc/local","serverutil","serverutil/signup","shutdown","store/inprocess","store/remote","store/transports","store/unassigned","subcmd","transports","upspin","upspin/proto","user","valid","version"]
- revision = "6976bf5d496b68fd9bd44c7bb5da9f7bc3bb2688"
+ revision = "93ca68f0c0e2d8f1fb5d2c7a1e0138ef561f3ef3"
[solve-meta]
analyzer-name = "dep"
diff --git a/vendor/upspin.io/cmd/cacheserver/doc.go b/vendor/upspin.io/cmd/cacheserver/doc.go
deleted file mode 100644
index 823a7dc..0000000
--- a/vendor/upspin.io/cmd/cacheserver/doc.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2017 The Upspin Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Cacheserver implements a directory and storage cache for Upspin. It is a
-long-lived process that interposes itself between the client and the remote
-services, presenting itself as a local HTTP server that behaves just like the
-remote ones.
-
-In its default mode, cacheserver runs in writeback mode, which means the
-writes are asynchronous and appear to complete quickly, but may take longer to
-propagate to the servers. A flag sets writethrough mode instead, which operates
-synchronously and more slowly, but also more safely. Cacheserver uses local disk
-to store data it has read or written. The size of the local disk area is
-configurable with a flag.
-
-The 'cache:' key should be set in the config file to enable the cacheserver.
-It takes a single value that can be:
-
- - 'yes' (or 'y') to use a default endpoint for the cacheserver
- - 'no' (or 'n') to specify no cacheserver (the default)
- - a local TCP port (e.g. localhost:9999) to specify a particular port
-
-The cacheserver will be started automatically by the upspin command or upspinfs if it is
-not already running, and continues to run once the program that started it
-has exited.
-
-Usage:
- cacheserver [flags]
-
-The flags are:
-
- -log=level
- Set the log level to 'level'.
- -cachedir=directory
- Cache all state in 'directory'/{storecache,dircache}.
- -writethrough
- Make storage cache writethrough.
- -cachesize=bytes
- Set the maximum bytes usable for the on disk cache to 'bytes'.
-
-Example $HOME/upspin/config entry:
-
- cache: yes
-*/
-package main // import "upspin.io/cmd/cacheserver"
diff --git a/vendor/upspin.io/cmd/cacheserver/main.go b/vendor/upspin.io/cmd/cacheserver/main.go
deleted file mode 100644
index 7571dc7..0000000
--- a/vendor/upspin.io/cmd/cacheserver/main.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2016 The Upspin Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
- "flag"
- "fmt"
- "os"
-
- "upspin.io/config"
- "upspin.io/flags"
- "upspin.io/log"
- "upspin.io/rpc"
- "upspin.io/version"
-)
-
-const cmdName = "cacheserver"
-
-func main() {
- flag.Usage = usage
- flags.Parse(flags.Server, "cachedir", "version")
-
- if flags.Version {
- fmt.Print(version.Version())
- return
- }
-
- // Load configuration and keys for this server. It needn't have a real username.
- cfg, err := config.FromFile(flags.Config)
- if err != nil {
- log.Fatal(err)
- }
-
- // Set any flags contained in the config.
- if err := config.SetFlagValues(cfg, cmdName); err != nil {
- log.Fatalf("%s: %s", cmdName, err)
- }
-
- // Serving address comes from config with flag overriding.
- var addr string
- ce, err := rpc.CacheEndpoint(cfg)
- if err != nil {
- log.Fatal(err)
- }
- if ce != nil {
- addr = string(ce.NetAddr)
- }
- if flags.NetAddr != "" {
- addr = flags.NetAddr
- }
- if len(addr) == 0 {
- log.Fatalf("no storage/dir cache network address specified")
- }
-
- // Start the server and wait until it terminates.
- done, err := serve(cfg, addr)
- if err != nil {
- log.Fatalf("cacheserver: %s", err)
- }
- if err := <-done; err != nil {
- log.Fatalf("cacheserver: %s", err)
- }
-}
-
-func usage() {
- fmt.Fprintln(os.Stderr, "Usage: cacheserver [flags]")
- fmt.Fprintln(os.Stderr, "For more information about cacheserver, run")
- fmt.Fprintln(os.Stderr, "\tgo doc upspin.io/cmd/cacheserver")
- fmt.Fprintln(os.Stderr, "")
- flag.PrintDefaults()
-}
diff --git a/vendor/upspin.io/cmd/cacheserver/serve.go b/vendor/upspin.io/cmd/cacheserver/serve.go
deleted file mode 100644
index da42bd8..0000000
--- a/vendor/upspin.io/cmd/cacheserver/serve.go
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2017 The Upspin Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
- "expvar"
- "flag"
- "net/http"
- "os"
- "path/filepath"
-
- "upspin.io/config"
- "upspin.io/dir/dircache"
- "upspin.io/flags"
- "upspin.io/log"
- "upspin.io/rpc/dirserver"
- "upspin.io/rpc/local"
- "upspin.io/rpc/storeserver"
- "upspin.io/store/storecache"
- "upspin.io/upspin"
-
- // Load required transports
- _ "upspin.io/transports"
-
- // Load useful packers
- _ "upspin.io/pack/ee"
- _ "upspin.io/pack/plain"
-)
-
-var (
- cacheSizeFlag = flag.Int64("cachesize", 5e9, "max disk `bytes` for cache")
- writethrough = flag.Bool("writethrough", false, "make storage cache writethrough")
-)
-
-func serve(cfg upspin.Config, addr string) (<-chan error, error) {
- // Stop the cache server recursing.
- cfg = config.SetValue(cfg, "cache", "no")
-
- // Calculate limits.
- maxRefBytes := (9 * (*cacheSizeFlag)) / 10
- maxLogBytes := maxRefBytes / 9
-
- myCacheDir := filepath.Join(flags.CacheDir, string(cfg.UserName()))
-
- // Link old structure cache files into the new structure.
- relocate(flags.CacheDir, myCacheDir)
-
- sc, blockFlusher, err := storecache.New(cfg, myCacheDir, maxRefBytes, *writethrough)
- if err != nil {
- return nil, err
- }
- ss := storeserver.New(cfg, sc, "")
-
- dc, err := dircache.New(cfg, myCacheDir, maxLogBytes, blockFlusher)
- if err != nil {
- return nil, err
- }
- ds := dirserver.New(cfg, dc, "")
-
- ln, err := local.Listen("tcp", addr)
- if err != nil {
- return nil, err
- }
-
- // Use our own ServerMux so that we can run in the same
- // process as a server using the default one.
- mux := &http.ServeMux{}
- httpServer := &http.Server{Handler: mux}
-
- mux.Handle("/api/Store/", ss)
- mux.Handle("/api/Dir/", ds)
- mux.Handle("/debug/vars", expvar.Handler())
- done := make(chan error)
- go func() {
- done <- httpServer.Serve(ln)
- }()
- return done, nil
-}
-
-// relocate links the old directory contents one level down into a
-// user specific directory. By linking the files one at a time rather
-// than linking or renaming the directories, we cause the least interference
-// between old and new worlds should an old server still be running.
-//
-// TODO(p): when everyone has had a chance to convert, replace this with
-// a routine that removes the old structure.
-func relocate(old, new string) {
- if _, err := os.Stat(new); err == nil || !os.IsNotExist(err) {
- // Already done, do nothing.
- return
- }
- if err := os.MkdirAll(new, 0700); err != nil {
- log.Debug.Printf("cacheserver/relocate: %s", err)
- return
- }
- walkAndMove(old, new, "storewritebackqueue", nil)
- walkAndMove(old, new, "storecache", nil)
- walkAndMove(old, new, "dircache", nil)
-}
-
-// walkAndMove links old files into new structure.
-func walkAndMove(oldDir, newDir, name string, info os.FileInfo) {
- old := filepath.Join(oldDir, name)
- new := filepath.Join(newDir, name)
- if info == nil {
- var err error
- info, err = os.Stat(old)
- if err != nil {
- log.Debug.Printf("cacheserver/walkAndMove: %s", err)
- return
- }
- }
-
- // Link files into new directory structure.
- if !info.Mode().IsDir() {
- if err := os.Link(old, new); err != nil {
- log.Debug.Printf("cacheserver/walkAndMove: %s", err)
- }
- return
- }
- if err := os.MkdirAll(new, 0700); err != nil {
- log.Debug.Printf("cacheserver/walkAndMove: %s", err)
- return
- }
-
- // Read and descend directories.
- f, err := os.Open(old)
- if err != nil {
- log.Debug.Printf("cacheserver/walkAndMove: %s", err)
- return
- }
- infos, err := f.Readdir(0)
- f.Close()
- if err != nil {
- log.Debug.Printf("cacheserver/walkAndMove: %s", err)
- return
-
- }
- for _, i := range infos {
- walkAndMove(old, new, i.Name(), i)
- }
-}
diff --git a/vendor/upspin.io/dir/inprocess/directory.go b/vendor/upspin.io/dir/inprocess/directory.go
index 9922de9..a30274e 100644
--- a/vendor/upspin.io/dir/inprocess/directory.go
+++ b/vendor/upspin.io/dir/inprocess/directory.go
@@ -867,6 +867,7 @@
if !found {
return nil, nil, errors.E(op, newEntry.Name, errors.NotExist)
}
+ newEntry.Sequence = seq
} else {
if !found {
// The provided sequence number may be only SeqNotExist or SeqIgnore.
diff --git a/vendor/upspin.io/errors/errors.go b/vendor/upspin.io/errors/errors.go
index 2eee77d..ef2e9e4 100644
--- a/vendor/upspin.io/errors/errors.go
+++ b/vendor/upspin.io/errors/errors.go
@@ -293,7 +293,7 @@
return e.s
}
-// Errorf is equivalent to errors.Errorf, but allows clients to import only this
+// Errorf is equivalent to fmt.Errorf, but allows clients to import only this
// package for all error handling.
func Errorf(format string, args ...interface{}) error {
return &errorString{fmt.Sprintf(format, args...)}
diff --git a/vendor/upspin.io/store/remote/remote.go b/vendor/upspin.io/store/remote/remote.go
index 4a42d95..75fcb4e 100644
--- a/vendor/upspin.io/store/remote/remote.go
+++ b/vendor/upspin.io/store/remote/remote.go
@@ -11,6 +11,7 @@
"io/ioutil"
"net/http"
"net/url"
+ "strings"
"sync"
"upspin.io/bind"
@@ -46,7 +47,7 @@
func (r *remote) Get(ref upspin.Reference) ([]byte, *upspin.Refdata, []upspin.Location, error) {
op := r.opf("Get", "%q", ref)
- if ref != upspin.HTTPBaseMetadata {
+ if !strings.HasPrefix(string(ref), "metadata:") {
if err := r.probeDirect(); err != nil {
op.error(err)
}
diff --git a/vendor/upspin.io/upspin/upspin.go b/vendor/upspin.io/upspin/upspin.go
index c6808c0..75c967d 100644
--- a/vendor/upspin.io/upspin/upspin.go
+++ b/vendor/upspin.io/upspin/upspin.go
@@ -88,8 +88,34 @@
// FlushWritebacksMetadata is used as a signal to flush the cache.
// A Get will return only after all writebacks have completed.
FlushWritebacksMetadata Reference = "metadata:FlushWritebacks"
+
+ // ListRefsMetadata is used by administrators to enumerate the
+ // references held by a StoreServer. Callers pass this value verbatim
+ // for the initial request and append a pagination token for subsequent
+ // requests. The response from such a request is a JSON-encoded
+ // ListRefsResponse.
+ ListRefsMetadata Reference = "metadata:ListRefs:"
)
+// ListRefsResponse describes a response from a StoreServer.Get
+// call for ListRefsMetadata.
+type ListRefsResponse struct {
+ // Refs holds the reference information.
+ Refs []ListRefsItem
+ // Next holds the token to fetch the next page,
+ // or the empty string if this is the last page.
+ Next string
+}
+
+// ListRefsItem describes a reference in a StoreServer,
+// returned as part of a ListRefsResponse.
+type ListRefsItem struct {
+ // Ref holds the reference name.
+ Ref Reference
+ // Size the length of the reference data.
+ Size int64
+}
+
// Signature is an ECDSA signature.
type Signature struct {
R, S *big.Int
@@ -553,7 +579,7 @@
const MaxBlockSize = 1024 * 1024 * 1024
// DirBlock describes a block of data representing a contiguous section of a file.
-// The block my be of any non-negative size, but in large files is usually
+// The block may be of any non-negative size, but in large files is usually
// BlockSize long.
type DirBlock struct {
Location Location // Location of data in store.