summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/rsc/appfs/proto/data.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-05-12 23:56:07 -0400
committerChristopher Speller <crspeller@gmail.com>2016-05-12 23:56:07 -0400
commit38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8 (patch)
treea4fde09672192b97d453ad605b030bd5a10c5a45 /vendor/github.com/mattermost/rsc/appfs/proto/data.go
parent84d2482ddbff9564c9ad75b2d30af66e3ddfd44d (diff)
downloadchat-38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8.tar.gz
chat-38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8.tar.bz2
chat-38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8.zip
Moving to glide
Diffstat (limited to 'vendor/github.com/mattermost/rsc/appfs/proto/data.go')
-rw-r--r--vendor/github.com/mattermost/rsc/appfs/proto/data.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/vendor/github.com/mattermost/rsc/appfs/proto/data.go b/vendor/github.com/mattermost/rsc/appfs/proto/data.go
new file mode 100644
index 000000000..ac15411a8
--- /dev/null
+++ b/vendor/github.com/mattermost/rsc/appfs/proto/data.go
@@ -0,0 +1,55 @@
+// Copyright 2012 The Go 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 proto defines the protocol between appfs client and server.
+package proto
+
+import "time"
+
+// An Auth appears, JSON-encoded, as the X-Appfs-Auth header line,
+// to authenticate a request made to the file server.
+// The authentication scheme could be made more sophisticated, but since
+// we are already forcing the use of TLS, a plain password is fine for now.
+type Auth struct {
+ Password string
+}
+
+// GET /.appfs/stat/path returns the metadata for a file or directory,
+// a JSON-encoded FileInfo.
+const StatURL = "/.appfs/stat/"
+
+// GET /.appfs/read/path returns the content of the file or directory.
+// The body of the response is the raw file or directory content.
+// The content of a directory is a sequence of JSON-encoded FileInfo.
+const ReadURL = "/.appfs/read/"
+
+// POST to /.appfs/write/path writes new data to a file.
+// The X-Appfs-SHA1 header is the SHA1 hash of the data.
+// The body of the request is the raw file content.
+const WriteURL = "/.appfs/write/"
+
+// POST to /.appfs/mount initializes the file system if it does not
+// yet exist in the datastore.
+const MkfsURL = "/.appfs/mkfs"
+
+// POST to /.appfs/create/path creates a new file or directory.
+// The named path must not already exist; its parent must exist.
+// The query parameter dir=1 indicates that a directory should be created.
+const CreateURL = "/.appfs/create/"
+
+// POST to /.appfs/remove/path removes the file or directory.
+// A directory must be empty to be removed.
+const RemoveURL = "/.appfs/remove/"
+
+// A FileInfo is a directory entry.
+type FileInfo struct {
+ Name string // final path element
+ ModTime time.Time
+ Size int64
+ IsDir bool
+}
+
+// PostContentType is the Content-Type for POSTed data.
+// There is no encoding or framing: it is just raw data bytes.
+const PostContentType = "x-appfs/raw"