當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Object.Remote方法代碼示例

本文整理匯總了Golang中github.com/ncw/rclone/fs.Object.Remote方法的典型用法代碼示例。如果您正苦於以下問題:Golang Object.Remote方法的具體用法?Golang Object.Remote怎麽用?Golang Object.Remote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/ncw/rclone/fs.Object的用法示例。


在下文中一共展示了Object.Remote方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Check

// Check checks all the attributes of the object are correct
func (i *Item) Check(t *testing.T, obj fs.Object, precision time.Duration) {
	i.CheckHashes(t, obj)
	if i.Size != obj.Size() {
		t.Errorf("%s/%s: Size incorrect - expecting %d got %d", obj.Fs().String(), obj.Remote(), i.Size, obj.Size())
	}
	i.CheckModTime(t, obj, obj.ModTime(), precision)
}
開發者ID:greendayo7,項目名稱:rclone,代碼行數:8,代碼來源:fstest.go

示例2: Add

// Add an object to the output.
// If the function returns true, the operation has been aborted.
// Multiple goroutines can safely add objects concurrently.
func (lo *ListOpts) Add(obj fs.Object) (abort bool) {
	remote := obj.Remote()
	_, err := lo.f.cipher.DecryptFileName(remote)
	if err != nil {
		fs.Debug(remote, "Skipping undecryptable file name: %v", err)
		return lo.ListOpts.IsFinished()
	}
	return lo.ListOpts.Add(lo.f.newObject(obj))
}
開發者ID:marcopaganini,項目名稱:rclone,代碼行數:12,代碼來源:crypt.go

示例3: CheckHashes

// CheckHashes checks all the hashes the object supports are correct
func (i *Item) CheckHashes(t *testing.T, obj fs.Object) {
	if obj == nil {
		t.Fatalf("Object is nil")
	}
	types := obj.Fs().Hashes().Array()
	for _, hash := range types {
		// Check attributes
		sum, err := obj.Hash(hash)
		if err != nil {
			t.Fatalf("%s: Failed to read hash %v for %q: %v", obj.Fs().String(), hash, obj.Remote(), err)
		}
		if !fs.HashEquals(i.Hashes[hash], sum) {
			t.Errorf("%s/%s: %v hash incorrect - expecting %q got %q", obj.Fs().String(), obj.Remote(), hash, i.Hashes[hash], sum)
		}
	}
}
開發者ID:greendayo7,項目名稱:rclone,代碼行數:17,代碼來源:fstest.go

示例4: Find

// Check off an item
func (is *Items) Find(t *testing.T, obj fs.Object, precision time.Duration) {
	i, ok := is.byName[obj.Remote()]
	if !ok {
		t.Errorf("Unexpected file %q", obj.Remote())
		return
	}
	delete(is.byName, obj.Remote())
	i.Check(t, obj, precision)
}
開發者ID:shimondoodkin,項目名稱:rclone,代碼行數:10,代碼來源:fstest.go

示例5: Find

// Find checks off an item
func (is *Items) Find(t *testing.T, obj fs.Object, precision time.Duration) {
	i, ok := is.byName[obj.Remote()]
	if !ok {
		i, ok = is.byNameAlt[obj.Remote()]
		assert.True(t, ok, fmt.Sprintf("Unexpected file %q", obj.Remote()))
	}
	delete(is.byName, i.Path)
	delete(is.byName, i.WinPath)
	i.Check(t, obj, precision)
}
開發者ID:yut148,項目名稱:rclone,代碼行數:11,代碼來源:fstest.go

示例6: Check

// Check checks all the attributes of the object are correct
func (i *Item) Check(t *testing.T, obj fs.Object, precision time.Duration) {
	if obj == nil {
		t.Fatalf("Object is nil")
	}
	// Check attributes
	Md5sum, err := obj.Md5sum()
	if err != nil {
		t.Fatalf("Failed to read md5sum for %q: %v", obj.Remote(), err)
	}
	if !fs.Md5sumsEqual(i.Md5sum, Md5sum) {
		t.Errorf("%s: Md5sum incorrect - expecting %q got %q", obj.Remote(), i.Md5sum, Md5sum)
	}
	if i.Size != obj.Size() {
		t.Errorf("%s: Size incorrect - expecting %d got %d", obj.Remote(), i.Size, obj.Size())
	}
	i.CheckModTime(t, obj, obj.ModTime(), precision)
}
開發者ID:nicot,項目名稱:rclone,代碼行數:18,代碼來源:fstest.go

示例7: Check

// Check checks all the attributes of the object are correct
func (i *Item) Check(t *testing.T, obj fs.Object, precision time.Duration) {
	if obj == nil {
		t.Fatalf("Object is nil")
	}
	types := obj.Fs().Hashes().Array()
	for _, hash := range types {
		// Check attributes
		sum, err := obj.Hash(hash)
		if err != nil {
			t.Fatalf("%s: Failed to read hash %v for %q: %v", obj.Fs().String(), hash, obj.Remote(), err)
		}
		if hash == fs.HashMD5 {
			if !fs.HashEquals(i.Md5sum, sum) {
				t.Errorf("%s/%s: md5 hash incorrect - expecting %q got %q", obj.Fs().String(), obj.Remote(), i.Md5sum, sum)
			}
		}
	}
	if i.Size != obj.Size() {
		t.Errorf("%s/%s: Size incorrect - expecting %d got %d", obj.Fs().String(), obj.Remote(), i.Size, obj.Size())
	}
	i.CheckModTime(t, obj, obj.ModTime(), precision)
}
開發者ID:wernight,項目名稱:rclone,代碼行數:23,代碼來源:fstest.go

示例8: CheckHashes

// CheckHashes checks all the hashes the object supports are correct
func (i *Item) CheckHashes(t *testing.T, obj fs.Object) {
	require.NotNil(t, obj)
	types := obj.Fs().Hashes().Array()
	for _, hash := range types {
		// Check attributes
		sum, err := obj.Hash(hash)
		require.NoError(t, err)
		assert.True(t, fs.HashEquals(i.Hashes[hash], sum), fmt.Sprintf("%s/%s: %v hash incorrect - expecting %q got %q", obj.Fs().String(), obj.Remote(), hash, i.Hashes[hash], sum))
	}
}
開發者ID:yut148,項目名稱:rclone,代碼行數:11,代碼來源:fstest.go

示例9: CheckModTime

// CheckModTime checks the mod time to the given precision
func (i *Item) CheckModTime(t *testing.T, obj fs.Object, modTime time.Time, precision time.Duration) {
	dt, ok := CheckTimeEqualWithPrecision(modTime, i.ModTime, precision)
	assert.True(t, ok, fmt.Sprintf("%s: Modification time difference too big |%s| > %s (%s vs %s) (precision %s)", obj.Remote(), dt, precision, modTime, i.ModTime, precision))
}
開發者ID:yut148,項目名稱:rclone,代碼行數:5,代碼來源:fstest.go

示例10: CheckModTime

// CheckModTime checks the mod time to the given precision
func (i *Item) CheckModTime(t *testing.T, obj fs.Object, modTime time.Time, precision time.Duration) {
	dt, ok := CheckTimeEqualWithPrecision(modTime, i.ModTime, precision)
	if !ok {
		t.Errorf("%s: Modification time difference too big |%s| > %s (%s vs %s) (precision %s)", obj.Remote(), dt, precision, modTime, i.ModTime, precision)
	}
}
開發者ID:nicot,項目名稱:rclone,代碼行數:7,代碼來源:fstest.go

示例11: CheckModTime

// check the mod time to the given precision
func (i *Item) CheckModTime(t *testing.T, obj fs.Object, modTime time.Time, precision time.Duration) {
	dt := modTime.Sub(i.ModTime)
	if dt >= precision || dt <= -precision {
		t.Errorf("%s: Modification time difference too big |%s| > %s (%s vs %s) (precision %s)", obj.Remote(), dt, precision, modTime, i.ModTime, precision)
	}
}
開發者ID:shimondoodkin,項目名稱:rclone,代碼行數:7,代碼來源:fstest.go


注:本文中的github.com/ncw/rclone/fs.Object.Remote方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。