/* Copyright 2011 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package main import ( "flag" "fmt" "io" "io/ioutil" "os" "strings" "sync" "camli/blobref" "camli/client" "camli/schema" ) type fileCmd struct { name string tag string makePermanode bool rollSplits bool havecache, statcache bool // Go into in-memory stats mode only; doesn't actually upload. memstats bool } func init() { RegisterCommand("file", func(flags *flag.FlagSet) CommandRunner { cmd := new(fileCmd) flags.BoolVar(&cmd.makePermanode, "permanode", false, "Create an associate a new permanode for the uploaded file or directory.") flags.StringVar(&cmd.name, "name", "", "Optional name attribute to set on permanode when using -permanode.") flags.StringVar(&cmd.tag, "tag", "", "Optional tag(s) to set on permanode when using -permanode. Single value or comma separated.") flags.BoolVar(&cmd.havecache, "statcache", false, "Use the stat cache, assuming unchanged files already uploaded in the past are still there. Fast, but potentially dangerous.") flags.BoolVar(&cmd.statcache, "havecache", false, "Use the 'have cache', a cache keeping track of what blobs the remote server should already have from previous uploads.") flags.BoolVar(&cmd.rollSplits, "rolling", false, "Use rolling checksum file splits.") flags.BoolVar(&cmd.memstats, "debug-memstats", false, "Enter debug in-memory mode; collecting stats only. Doesn't upload anything.") flagCacheLog = flags.Bool("logcache", false, "log caching details") return cmd }) } func (c *fileCmd) Usage() { fmt.Fprintf(os.Stderr, "Usage: camput [globalopts] file [fileopts] \n") } func (c *fileCmd) Examples() []string { return []string{ "[opts]