Blob store implementation for storing content inside s3 compatible storage Key conceptions:

  • relative path created in format modelName|relativePathFromModelDir to hide real file place from client
  • OS user temp folder used for store temporary content
  • delete operation is forbidden since models must be under version control

Singleton

# new S3BlobStore (storeConfig:  object, appInstance:  ServerApp, sessionInstance:  UBSession, options:  object)

Arguments:

Methods

# doDeletion (attribute:  UBEntityAttribute, ID:  number, blobInfo:  BlobStoreItem) instance

Arguments:

# fillResponse (request:  BlobStoreRequest, blobInfo:  BlobStoreItem, req:  THTTPRequest, resp:  THTTPResponse, preventChangeRespOnErroropt:  boolean) → boolean instance

Fill HTTP response for getDocument request

Arguments:

# genNewPlacement (attribute:  UBEntityAttribute, dirtyItem:  BlobStoreItem, ID:  number) → Object instance

Calculate a relative path, file name and bucket for a new BLOB item

Arguments:

# getContent (request:  BlobStoreRequest, blobInfo:  BlobStoreItem, optionsopt:  object) → string | UBMail.TubSendMailAttachKind.Buffer | ArrayBuffer | null instance

Retrieve BLOB content from blob store

Arguments:
  • request: BlobStoreRequest
  • blobInfo: BlobStoreItem

    JSON retrieved from a DB.

  • options: object
    • encoding:  string | null

      Possible values: 'bin' 'ascii' 'binary' 'hex' ucs2/ucs-2/utf16le/utf-16le utf8/utf-8 base64 if null will return Buffer, if bin - ArrayBuffer

# getContentFilePath (request:  BlobStoreRequest, blobInfo:  BlobStoreItem) → string instance

Returns full path to the file with BLOB content. For s3 objects returns s3://bucket/path

Arguments:

# getPermanentFileName (blobItem:  BlobStoreItem, requestopt:  BlobStoreRequest) → string instance

If item stored in file system - returns full path to file, if in S3 - s3 URL

Return:

In case of item not exists - return empty string ''

Arguments:

# isStoredInS3 (requestopt:  BlobStoreRequest, blobInfo:  BlobStoreItem) → boolean instance

Returns true in case item stored in S3 storage

Arguments:

# persist (attribute:  UBEntityAttribute, ID:  number, dirtyItem:  BlobStoreItem, newRevision:  number) → BlobStoreItem | null instance

Move content defined by dirtyItem from temporary to permanent store. TIPS: in v0 (UB<5) if file updated then implementation takes a store from old item. This raise a problem - old store may be in archive state (readonly) So in UB5 we change implementation to use a store defined in the attribute for new items

Return a new attribute content which describe a place of the BLOB in permanent store

Arguments: