aboutsummaryrefslogtreecommitdiff
path: root/bulk.go
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2022-10-26 11:31:22 +0200
committerSandro Jäckel <sandro.jaeckel@sap.com>2022-10-26 14:05:42 +0200
commit04ce17415f25dbf10eba954212c8428ae630df88 (patch)
tree1aca7ceab052f17a44bb903fb5a8bd45202bd54c /bulk.go
parentfd6e57b6239655722884a49a86be0f051cc32bde (diff)
downloadgo-schwift-04ce17415f25dbf10eba954212c8428ae630df88.tar.gz
Format with go 1.19
Diffstat (limited to 'bulk.go')
-rw-r--r--bulk.go56
1 files changed, 28 insertions, 28 deletions
diff --git a/bulk.go b/bulk.go
index a160652..3aa40db 100644
--- a/bulk.go
+++ b/bulk.go
@@ -30,7 +30,7 @@ import (
"github.com/majewsky/schwift/capabilities"
)
-//BulkUploadFormat enumerates possible archive formats for Container.BulkUpload().
+// BulkUploadFormat enumerates possible archive formats for Container.BulkUpload().
type BulkUploadFormat string
const (
@@ -42,11 +42,11 @@ const (
BulkUploadTarBzip2 BulkUploadFormat = "tar.bz2"
)
-//BulkUpload extracts an archive (which may contain multiple files) into a
-//Swift account. The path of each file in the archive is appended to the
-//uploadPath to form the FullName() of the resulting Object.
+// BulkUpload extracts an archive (which may contain multiple files) into a
+// Swift account. The path of each file in the archive is appended to the
+// uploadPath to form the FullName() of the resulting Object.
//
-//For example, when uploading an archive that contains the file "a/b/c":
+// For example, when uploading an archive that contains the file "a/b/c":
//
// //This uploads the file into the container "a" as object "b/c".
// account.BulkUpload("", format, contents, nil)
@@ -55,15 +55,15 @@ const (
// //This uploads the file into the container "foo" as object "bar/baz/a/b/c".
// account.BulkUpload("foo/bar/baz", format, contents, nil)
//
-//The first return value indicates the number of files that have been created
-//on the server side. This may be lower than the number of files in the archive
-//if some files could not be saved individually (e.g. because a quota was
-//exceeded in the middle of the archive extraction).
+// The first return value indicates the number of files that have been created
+// on the server side. This may be lower than the number of files in the archive
+// if some files could not be saved individually (e.g. because a quota was
+// exceeded in the middle of the archive extraction).
//
-//If not nil, the error return value is *usually* an instance of BulkError.
+// If not nil, the error return value is *usually* an instance of BulkError.
//
-//This operation returns (0, ErrNotSupported) if the server does not support
-//bulk-uploading.
+// This operation returns (0, ErrNotSupported) if the server does not support
+// bulk-uploading.
func (a *Account) BulkUpload(uploadPath string, format BulkUploadFormat, contents io.Reader, opts *RequestOptions) (int, error) {
caps, err := a.Capabilities()
if err != nil {
@@ -115,18 +115,18 @@ func makeBulkObjectError(fullName string, statusCode int) BulkObjectError {
}
}
-//BulkDelete deletes a large number of objects (and containers) at once.
-//Containers are queued at the end of the deletion, so a container can be
-//deleted in the same call in which all objects in it are deleted.
+// BulkDelete deletes a large number of objects (and containers) at once.
+// Containers are queued at the end of the deletion, so a container can be
+// deleted in the same call in which all objects in it are deleted.
//
-//For example, to delete all objects in a container:
+// For example, to delete all objects in a container:
//
// var container *schwift.Container
//
// objects, err := container.Objects().Collect()
// numDeleted, numNotFound, err := container.Account().BulkDelete(objects, nil, nil)
//
-//To also delete the container:
+// To also delete the container:
//
// var container *schwift.Container
//
@@ -134,14 +134,14 @@ func makeBulkObjectError(fullName string, statusCode int) BulkObjectError {
// numDeleted, numNotFound, err := container.Account().BulkDelete(
// objects, []*schwift.Container{container}, nil)
//
-//If the server does not support bulk-deletion, this function falls back to
-//deleting each object and container individually, and aggregates the result.
+// If the server does not support bulk-deletion, this function falls back to
+// deleting each object and container individually, and aggregates the result.
//
-//If not nil, the error return value is *usually* an instance of BulkError.
+// If not nil, the error return value is *usually* an instance of BulkError.
//
-//The objects may be located in multiple containers, but they and the
-//containers must all be located in the given account. (Otherwise,
-//ErrAccountMismatch is returned.)
+// The objects may be located in multiple containers, but they and the
+// containers must all be located in the given account. (Otherwise,
+// ErrAccountMismatch is returned.)
func (a *Account) BulkDelete(objects []*Object, containers []*Container, opts *RequestOptions) (numDeleted int, numNotFound int, deleteError error) {
//validate that all given objects are in this account
for _, obj := range objects {
@@ -200,8 +200,8 @@ func (a *Account) BulkDelete(objects []*Object, containers []*Container, opts *R
return numDeleted, numNotFound, nil
}
-//Implementation of BulkDelete() for servers that *do not* support bulk
-//deletion.
+// Implementation of BulkDelete() for servers that *do not* support bulk
+// deletion.
func (a *Account) bulkDeleteSingle(objects []*Object, containers []*Container, opts *RequestOptions) (int, int, error) {
var (
numDeleted = 0
@@ -256,9 +256,9 @@ func (a *Account) bulkDeleteSingle(objects []*Object, containers []*Container, o
}
}
-//Implementation of BulkDelete() for servers that *do* support bulk deletion.
-//This function is called *after* chunking, so `len(names) <=
-//account.Capabilities.BulkDelete.MaximumDeletesPerRequest`.
+// Implementation of BulkDelete() for servers that *do* support bulk deletion.
+// This function is called *after* chunking, so `len(names) <=
+// account.Capabilities.BulkDelete.MaximumDeletesPerRequest`.
func (a *Account) bulkDelete(names []string, opts *RequestOptions) (int, int, error) {
req := Request{
Method: "DELETE",