1: <?php
2: /**
3: * PHP OpenCloud library.
4: *
5: * @copyright Copyright 2013 Rackspace US, Inc. See COPYING for licensing information.
6: * @license https://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
7: * @version 1.6.0
8: * @author Glen Campbell <glen.campbell@rackspace.com>
9: * @author Jamie Hannaford <jamie.hannaford@rackspace.com>
10: */
11:
12: namespace OpenCloud\ObjectStore;
13:
14: use OpenCloud\Common\Service as CommonService;
15:
16: define('SWIFT_MAX_OBJECT_SIZE', 5 * 1024 * 1024 * 1024 + 1);
17:
18: /**
19: * An abstract base class for common code shared between ObjectStore\Service
20: * (container) and ObjectStore\CDNService (CDN containers).
21: *
22: * @todo Maybe we use Traits instead of this small abstract class?
23: */
24: abstract class AbstractService extends CommonService
25: {
26:
27: const MAX_CONTAINER_NAME_LEN = 256;
28: const MAX_OBJECT_NAME_LEN = 1024;
29: const MAX_OBJECT_SIZE = SWIFT_MAX_OBJECT_SIZE;
30:
31: /**
32: * Creates a Container resource object.
33: *
34: * @param mixed $cdata The name of the container or an object from which to set values
35: * @return OpenCloud\ObjectStore\Resource\Container
36: */
37: public function container($cdata = null)
38: {
39: return new Resource\Container($this, $cdata);
40: }
41:
42: /**
43: * Returns a Collection of Container objects.
44: *
45: * @param array $filter An array to filter the results
46: * @return OpenCloud\Common\Collection
47: */
48: public function containerList(array $filter = array())
49: {
50: $filter['format'] = 'json';
51:
52: return $this->collection(
53: 'OpenCloud\ObjectStore\Resource\Container', $this->url(null, $filter)
54: );
55: }
56:
57: }
58: