From cad4a10319b98dd15c0a74d0fea13a2da4a0d3cc Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Mon, 29 Jan 2018 21:19:39 +0100 Subject: lay down the full Account API --- doc.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'doc.go') diff --git a/doc.go b/doc.go index d4cb6bd..1fe46e4 100644 --- a/doc.go +++ b/doc.go @@ -25,9 +25,9 @@ It uses Gophercloud (https://github.com/gophercloud/gophercloud) for authentication, so you usually start by obtaining a gophercloud.ServiceClient for Swift like so: - authOptions, err := openstack.AuthOptionsFromEnv() + authOptions, err := openstack.AuthOptionsFromEnv() // or build a gophercloud.AuthOptions instance yourself provider, err := openstack.AuthenticatedClient(authOptions) - client, err := openstack.NewObjectStorageV1(provider, gophercloud.EndpointOpts {}) + client, err := openstack.NewObjectStorageV1(provider, gophercloud.EndpointOpts{}) Or, if you use Swift's built-in authentication instead of Keystone: @@ -44,16 +44,14 @@ API. Caching When a GET or HEAD request is sent by an Account, Container or Object instance, -the metadata associated with that thing will be stored in that instance. You -can therefore access metadata attributes directly via their accessors and -everything just works, i.e. the first call to a getter will retrieve the -metadata: +the headers associated with that thing will be stored in that instance and not +retrieved again. obj := account.Container("foo").Object("bar") - t, err := obj.LastModified() //sends HTTP request "HEAD /foo/bar" - assert(err == nil) - t, err := obj.LastModified() //returns cached value immediately + hdr, err := obj.Headers() //sends HTTP request "HEAD /foo/bar" + ... + hdr, err = obj.Headers() //returns cached values immediately If this behavior is not desired, the Invalidate() method can be used to clear caches on any Account, Container or Object instance. -- cgit v1.2.3