Add sync automata valid cases

This commit is contained in:
Harshavardhana
2015-05-16 15:38:00 -07:00
parent 128be5c1dc
commit 703dc21857
4 changed files with 47 additions and 9 deletions
+8
View File
@@ -22,6 +22,14 @@ import (
"github.com/minio/minio/pkg/iodine"
)
// intMax - return maximum value for any given integer
func intMax(x, y int) int {
if x > y {
return x
}
return y
}
// isValidRetry - check if we should retry for the given error sequence
func isValidRetry(err error) bool {
err = iodine.New(err, nil)
+1 -1
View File
@@ -28,7 +28,7 @@ import (
)
//
// NOITE: All the parse rules should reduced to A: Copy(Source, Target).
// NOTE: All the parse rules should reduced to A: Copy(Source, Target).
//
// * SINGLE SOURCE - VALID
// =======================
-8
View File
@@ -29,14 +29,6 @@ const (
updateString = "mc cp " + mcUpdateURL + " ${HOME}/bin/mc"
)
// intMax - return maximum value for any given integer
func intMax(x, y int) int {
if x > y {
return x
}
return y
}
// printUpdateNotify - inspired from Yeoman project npm package https://github.com/yeoman/update-notifier
func printUpdateNotify(latestVersion, currentVersion string) {
// TODO - make this configurable
+38
View File
@@ -1,3 +1,19 @@
/*
* Minio Client (C) 2015 Minio, 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 (
@@ -6,6 +22,28 @@ import (
"github.com/minio/minio/pkg/iodine"
)
//
// NOTE: All the parse rules should reduced to A: Copy(Source, Target).
//
// * SINGLE SOURCE - VALID
// =======================
// A: sync(f, f) -> copy(f, f)
// B: sync(f, d) -> copy(f, d/f) -> A
// C: sync(f, []d) -> []copy(f, d/f) -> []A
// D: sync(d1..., d2) -> []copy(d1/f, d2/d1/f) -> []A
// E: sync(d1..., []d2) -> [][]copy(d1/f, d2/d1/f) -> [][]A
//
// * SINGLE SOURCE - INVALID
// =========================
// sync(d, *)
// sync(d..., f)
// sync(*, d...)
//
// * MULTI-TARGET RECURSIVE - INVALID
// ==================================
// sync(*, f1)
// sync(*, []f1)
type syncURLs copyURLs
// prepareCopyURLs - prepares target and source URLs for syncing.