Documentation

GoogleCloudStorage extends AbstractData
in package

AbstractData

Abstract model for data access

Table of Contents

Properties

$_last_cache  : array<string|int, mixed>
cache for the traffic limiter
$_bucket  : Bucket
GCS bucket
$_client  : StorageClient
GCS client
$_prefix  : string
object prefix
$_uniformacl  : bool
bucket acl type

Methods

__construct()  : mixed
instantiantes a new Google Cloud Storage data backend.
create()  : bool
Create a paste.
createComment()  : bool
Create a comment in a paste.
delete()  : mixed
Delete a paste and its discussion.
exists()  : bool
Test if a paste exists.
existsComment()  : bool
Test if a comment exists.
getAllPastes()  : array<string|int, mixed>
Returns all paste ids
getValue()  : string
Load a value.
purge()  : mixed
Perform a purge of old pastes, at most the given batchsize is deleted.
purgeValues()  : void
Purge outdated entries.
read()  : array<string|int, mixed>|false
Read a paste.
readComments()  : array<string|int, mixed>
Read all comments of paste.
setValue()  : bool
For GoogleCloudStorage, the value will also be stored in the metadata for the namespaces traffic_limiter and purge_limiter.
_getExpiredPastes()  : array<string|int, mixed>
Returns up to batch size number of paste ids that have expired
getOpenSlot()  : int|string
Get next free slot for comment from postdate.
upgradePreV1Format()  : array<string|int, mixed>
Upgrade pre-version 1 pastes with attachment to version 1 format.
_getKey()  : string
returns the google storage object key for $pasteid in $this->_bucket.
_upload()  : bool
Uploads the payload in the $this->_bucket under the specified key.

Properties

$_last_cache

cache for the traffic limiter

protected array<string|int, mixed> $_last_cache = array()
Tags
access

protected

$_uniformacl

bucket acl type

private bool $_uniformacl = false
Tags
access

private

Methods

__construct()

instantiantes a new Google Cloud Storage data backend.

public __construct(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>
Tags
access

public

create()

Create a paste.

public create(mixed $pasteid, array<string|int, mixed> $paste) : bool
Parameters
$pasteid : mixed
$paste : array<string|int, mixed>
Tags
inheritDoc
Return values
bool

createComment()

Create a comment in a paste.

public createComment(mixed $pasteid, mixed $parentid, mixed $commentid, array<string|int, mixed> $comment) : bool
Parameters
$pasteid : mixed
$parentid : mixed
$commentid : mixed
$comment : array<string|int, mixed>
Tags
inheritDoc
Return values
bool

delete()

Delete a paste and its discussion.

public delete(mixed $pasteid) : mixed
Parameters
$pasteid : mixed
Tags
inheritDoc

exists()

Test if a paste exists.

public exists(mixed $pasteid) : bool
Parameters
$pasteid : mixed
Tags
inheritDoc
Return values
bool

existsComment()

Test if a comment exists.

public existsComment(mixed $pasteid, mixed $parentid, mixed $commentid) : bool
Parameters
$pasteid : mixed
$parentid : mixed
$commentid : mixed
Tags
inheritDoc
Return values
bool

getAllPastes()

Returns all paste ids

public getAllPastes() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

getValue()

Load a value.

public getValue(mixed $namespace[, mixed $key = '' ]) : string
Parameters
$namespace : mixed
$key : mixed = ''
Tags
inheritDoc
Return values
string

purge()

Perform a purge of old pastes, at most the given batchsize is deleted.

public purge(int $batchsize) : mixed
Parameters
$batchsize : int
Tags
access

public

purgeValues()

Purge outdated entries.

public purgeValues(mixed $namespace, mixed $time) : void
Parameters
$namespace : mixed
$time : mixed
Tags
inheritDoc

read()

Read a paste.

public read(mixed $pasteid) : array<string|int, mixed>|false
Parameters
$pasteid : mixed
Tags
inheritDoc
Return values
array<string|int, mixed>|false

readComments()

Read all comments of paste.

public readComments(mixed $pasteid) : array<string|int, mixed>
Parameters
$pasteid : mixed
Tags
inheritDoc
Return values
array<string|int, mixed>

setValue()

For GoogleCloudStorage, the value will also be stored in the metadata for the namespaces traffic_limiter and purge_limiter.

public setValue(mixed $value, mixed $namespace[, mixed $key = '' ]) : bool
Parameters
$value : mixed
$namespace : mixed
$key : mixed = ''
Tags
inheritDoc
Return values
bool

_getExpiredPastes()

Returns up to batch size number of paste ids that have expired

protected _getExpiredPastes(mixed $batchsize) : array<string|int, mixed>
Parameters
$batchsize : mixed
Tags
inheritDoc
Return values
array<string|int, mixed>

getOpenSlot()

Get next free slot for comment from postdate.

protected getOpenSlot(array<string|int, mixed> &$comments, int|string $postdate) : int|string
Parameters
$comments : array<string|int, mixed>
$postdate : int|string
Tags
access

protected

Return values
int|string

upgradePreV1Format()

Upgrade pre-version 1 pastes with attachment to version 1 format.

protected static upgradePreV1Format(array<string|int, mixed> $paste) : array<string|int, mixed>
Parameters
$paste : array<string|int, mixed>
Tags
access

protected

static
Return values
array<string|int, mixed>

_getKey()

returns the google storage object key for $pasteid in $this->_bucket.

private _getKey( $pasteid) : string
Parameters
$pasteid :

string to get the key for

Tags
access

private

Return values
string

_upload()

Uploads the payload in the $this->_bucket under the specified key.

private _upload( $key,  $payload) : bool

The entire payload is stored as a JSON document. The metadata is replicated as the GCS object's metadata except for the fields attachment, attachmentname and salt.

Parameters
$key :

string to store the payload under

$payload :

array to store

Return values
bool

true if successful, otherwise false.


        
On this page

Search results