aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Majewsky <stefan.majewsky@sap.com>2020-10-14 14:27:16 +0200
committerStefan Majewsky <stefan.majewsky@sap.com>2020-10-14 14:27:16 +0200
commitbd1c74594efeab1268531225d304ebae8992e286 (patch)
tree4e267dff131fa7410937b23c66d03a034b43338c
parent80c09ef2a88d4a46ae566390b057477bd457bf3d (diff)
downloadgo-schwift-bd1c74594efeab1268531225d304ebae8992e286.tar.gz
document non-threadsafety
-rw-r--r--account.go9
-rw-r--r--container.go6
-rw-r--r--object.go12
3 files changed, 27 insertions, 0 deletions
diff --git a/account.go b/account.go
index 0e9e85e..85299df 100644
--- a/account.go
+++ b/account.go
@@ -92,6 +92,9 @@ func (a *Account) Backend() Backend {
//has not been cached yet, a HEAD request is issued on the account.
//
//This operation fails with http.StatusNotFound if the account does not exist.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (a *Account) Headers() (AccountHeaders, error) {
if a.headers != nil {
return *a.headers, nil
@@ -116,6 +119,9 @@ func (a *Account) Headers() (AccountHeaders, error) {
//Invalidate clears the internal cache of this Account instance. The next call
//to Headers() on this instance will issue a HEAD request on the account.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (a *Account) Invalidate() {
a.headers = nil
}
@@ -178,6 +184,9 @@ func (a *Account) Containers() *ContainerIterator {
//Capabilities queries the GET /info endpoint of the Swift server providing
//this account. Capabilities are cached, so the GET request will only be sent
//once during the first call to this method.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (a *Account) Capabilities() (Capabilities, error) {
if a.caps != nil {
return *a.caps, nil
diff --git a/container.go b/container.go
index 4c94f87..de85f62 100644
--- a/container.go
+++ b/container.go
@@ -74,6 +74,9 @@ func (c *Container) Exists() (bool, error) {
//has not been cached yet, a HEAD request is issued on the container.
//
//This operation fails with http.StatusNotFound if the container does not exist.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (c *Container) Headers() (ContainerHeaders, error) {
if c.headers != nil {
return *c.headers, nil
@@ -159,6 +162,9 @@ func (c *Container) Delete(opts *RequestOptions) error {
//Invalidate clears the internal cache of this Container instance. The next call
//to Headers() on this instance will issue a HEAD request on the container.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (c *Container) Invalidate() {
c.headers = nil
}
diff --git a/object.go b/object.go
index 8669719..9969ea9 100644
--- a/object.go
+++ b/object.go
@@ -104,6 +104,9 @@ func (o *Object) Exists() (bool, error) {
//Object.SymlinkHeaders() to obtain the metadata for the symlink instead.
//
//This operation fails with http.StatusNotFound if the object does not exist.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (o *Object) Headers() (ObjectHeaders, error) {
if o.headers != nil {
return *o.headers, nil
@@ -409,6 +412,9 @@ func (o *Object) Delete(opts *DeleteOptions, ropts *RequestOptions) error {
//Invalidate clears the internal cache of this Object instance. The next call
//to Headers() on this instance will issue a HEAD request on the object.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (o *Object) Invalidate() {
o.headers = nil
o.symlinkHeaders = nil
@@ -426,6 +432,9 @@ func (o *Object) Invalidate() {
// str, err := object.Download(nil).AsString()
//
//See documentation on type DownloadedObject for details.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (o *Object) Download(opts *RequestOptions) DownloadedObject {
resp, err := Request{
Method: "GET",
@@ -542,6 +551,9 @@ func (o *Object) SymlinkTo(target *Object, opts *SymlinkOptions, ropts *RequestO
//a symlink, the cache for Object.Headers() has already been populated.
//
//This operation fails with http.StatusNotFound if the object does not exist.
+//
+//WARNING: This method is not thread-safe. Calling it concurrently on the same
+//object results in undefined behavior.
func (o *Object) SymlinkHeaders() (headers ObjectHeaders, target *Object, err error) {
if o.symlinkHeaders == nil {
o.symlinkHeaders, err = o.fetchHeaders(&RequestOptions{