Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AGCCloudDBZoneConfig

en

This class is used to create a AGCCloudDBZoneConfig object and configure Cloud DB zone information such as the synchronization property, access property, encrypted storage property, and data persistency property.

zh

该类用于创建 AGCCloudDBZoneConfig 对象,配置 Cloud DB zone 的同步属性、访问属性、加密存储和数据持久化属性等信息。

Hierarchy

Index

Constructors

constructor

Properties

Private cls_ServiceAGCCloudDB

cls_ServiceAGCCloudDB: string = "org/cocos2dx/javascript/service/db/CloudDBZoneConfigHelper"

zoneId

zoneId: string

Methods

getAccessProperty

  • en

    Developers can invoke this method to obtain the access property of Cloud DB zone on the device.

    zh

    开发者调用此方法获取端侧 Cloud DB zone 的访问属性。

    Returns AccessProperty

    Access property of the Cloud DB zone.

getCapacity

  • getCapacity(): number
  • en

    Developers can invoke this method to obtain the current Cloud DB zone storage space size on the device and determine whether to change the storage space size to properly allocate storage resources and improve resource utilization.

    zh

    开发者调用此方法获取端侧当前 Cloud DB zone的存储空间大小,用于判断是否需要修改该存储空间大小,以便更合理的分配存储资源,提升资源利用率。

    Returns number

    Size of the Cloud DB zone, in bytes. -1: The size is unlimited. If the value is an integer other than -1, the value is the actual size.

getCloudDBZoneName

  • getCloudDBZoneName(): string
  • en

    Developers can invoke this method to obtain the name of Cloud DB zone on the local device.

    zh

    开发者调用此方法获取端侧 Cloud DB zone 的名称。

    Returns string

    Cloud DB zone name.

getPersistenceEnabled

  • getPersistenceEnabled(): boolean
  • en

    Developers can invoke this method to obtain data persistence information of Cloud DB zone from the device.

    zh

    开发者调用此方法获取端侧 Cloud DB zone 的数据持久化信息。

    Returns boolean

    Data persistency property of the Cloud DB zone.

getSyncProperty

  • en

    Developers can invoke this method to obtain the data synchronization property of Cloud DB zone on the device.

    zh

    开发者调用此方法获取端侧 Cloud DB zone 的数据同步属性。

    Returns SyncProperty

    Synchronization property of the Cloud DB zone.

isEncrypted

  • isEncrypted(): boolean
  • en

    Developers can invoke this method to check whether the Cloud DB zone is encrypted on the local device.

    zh

    开发者调用此方法判断端侧 Cloud DB zone 是否加密。

    Returns boolean

    Specifies whether to encrypt Cloud DB zone on the device.

setCapacity

  • setCapacity(capacity: number): void
  • en

    Developers can invoke this method to set the storage space size of Cloud DB zone on the device. You can set the storage space size of Cloud DB zone to unlimited or a specific value. The value must be greater than or equal to 1 MB. If the value is not set or is invalid, the system uses the default value 100 MB. If the configured storage space of Cloud DB zone does not meet requirements, you can invoke this method to change the storage space of Cloud DB zone. After changing the storage space, you need to invoke the openCloudDBZone() method again for the change to take effect. You can invoke this method to set the storage space size only when the synchronization property of Cloud DB zone is in cache mode and the data persistency property is persistent storage. When the data stored in Cloud DB zone exceeds the threshold, the data that is not used for the longest time and has been synchronized will be deleted. The data that is not synchronized will not be deleted.

    zh

    开发者调用此方法设置端侧 Cloud DB zone 的存储空间大小。 Cloud DB zone 存储空间大小可设置为无限制,也可设置具体的存储空间大小。设置具体值时,必须大于等于 1MB,如开发者未设置或者设置值无效时,系统会设置为默认值 100 MB。设置 Cloud DB zone 的存储空间大小后,如果存储空间不满足当前所需,可通过该方法修改 Cloud DB zone 的存储空间大小,修改存空间大小后需要重新 openCloudDBZone(),修改的值才会生效。 仅当 Cloud DB zone 的数据同步属性为缓存模式且数据持久化属性为持久化存储时,开发者才允许调用此方法设置存储空间大小。 当 Cloud DB zone 存储的数据超过设定的阈值时,会删除最久未使用且超过阈值范围已同步的数据,未同步的数据不会被删除。

    Parameters

    • capacity: number

      Size of the Cloud DB zone, in bytes. The value is of the long type. Default value: 104857600 (100 MB). The options are as follows: -1: The size is unlimited. When the value is an integer, it is the actual size. The value must be greater than or equal to 1048576 (1 MB).

    Returns void

setEncryptedKey

  • setEncryptedKey(key: string, rekey: string): void
  • en

    Developers can invoke this method to set or modify the encryption key for data stored in the Cloud DB zone on the local device. The encryption key can be set only when Cloud DB zone data persistence is allowed. Data encryption is set by Cloud DB zone. The options are as follows: If values of key and rekey are both null or empty strings, Cloud DB zone does not need to be encrypted. If the value of key is not null or an empty string, and the value of rekey is null or an empty string, Cloud DB zone needs to be encrypted. If values of key and rekey is neither null nor an empty string, the original key of Cloud DB zone is changed to the new key. If the value of key is null or an empty string, and the value of rekey is not null or an empty string, an exception will occur.

    zh

    开发者调用此方法设置或者修改端侧 Cloud DB zone 数据加密存储的密钥,仅在 Cloud DB zone 的数据允许持久化时支持设置加密密钥。数据加密以 Cloud DB zone 为粒度进行设置。根据请求参数值,分为如下四种情况: 当参数 key 的值为 null 或者空字符串,且参数 rekey 的值为 null 或者空字符串时,该 Cloud DB zone 不需要加密。 当参数 key 的值不为 null 或者空字符串,且参数 rekey 的值为 null 或者空字符串时,该 Cloud DB zone 需要加密。 当参数 key 的值不为 null 或者空字符串,且参数 rekey 的值不为 null 或者空字符串时,将该 Cloud DB zone 的原密钥修改为新密钥。 当参数 key 的值为 null 或者空字符串,且参数 rekey 的值不为 null 或者空字符串时,为非法入参,系统会抛异常。

    Parameters

    • key: string

      Encryption key of Cloud DB zone on the device. The value contains 1 to 128 characters. This parameter is mandatory when a key is added.

    • rekey: string

      New encryption key of Cloud DB zone on the device. The value contains 1 to 128 characters. This parameter is mandatory when the key is changed. Otherwise, the parameter value is null or an empty string.

    Returns void

setPersistenceEnabled

  • setPersistenceEnabled(isPerEnable: boolean): void
  • en

    Developers can invoke this method to set the data persistency property of Cloud DB zone on the local device. When the synchronization property of Cloud DB zone is in local mode, only persistent data storage is supported.

    zh

    开发者调用此方法设置端侧 Cloud DB zone 的数据持久化属性。Cloud DB zone 的数据同步属性为本地模式时,只支持数据持久化存储。

    Parameters

    • isPerEnable: boolean

      Data persistency property of the Cloud DB zone. Default value: true.

    Returns void

Static callStaticMethod

  • callStaticMethod(...args: (string | number | false | true)[]): any

Static createConfig

  • en

    Developers can invoke this method to create a AGCCloudDBZoneConfig object on the device. The AGCCloudDBZoneConfig object contains Cloud DB zone configuration information such as the name, synchronization property, and access property. After a Cloud DB zone is created, the Cloud DB zone name, synchronization property, and access property of the AGCCloudDBZoneConfig cannot be modified. After a Cloud DB zone is created, when the developer invokes openCloudDBZone() again, the system checks whether the attributes specified in AGCCloudDBZoneConfig are the same as those specified when AGCCloudDBZoneConfig is created. If they are different, the system throws an exception.

    zh

    开发者调用此方法在端侧创建 AGCCloudDBZoneConfig 对象,AGCCloudDBZoneConfig 对象中包含 Cloud DB zone 的名称、同步属性和访问属性等配置信息。创建 Cloud DB zone 成功后,不允许修改 AGCCloudDBZoneConfig 中的 Cloud DB zone 名称、同步属性和访问属性。在创建 Cloud DB zone 成功后,开发者再次调用 openCloudDBZone() 时,系统会校验本次 AGCCloudDBZoneConfig 中指定的属性与创建 AGCCloudDBZoneConfig 时指定的属性是否一致,如果不一致,系统会抛出异常。

    Parameters

    • zoneId: string

      Name of a Cloud DB zone which represents a unique data storage zone.

    • sync: SyncProperty

      Synchronization property of the Cloud DB zone, which specifies whether to synchronize data of Cloud DB zone between the device and the cloud and the synchronization mode. The values are as follows: SyncProperty.CLOUDDBZONE_LOCAL_ONLY, SyncProperty.CLOUDDBZONE_CLOUD_CACHE

    • Default value access: CLOUDDBZONE_PUBLIC = AccessProperty.CLOUDDBZONE_PUBLIC

      Access property of the Cloud DB zone, which is used to define the security property when an application accesses Cloud DB zone. The value is of the enumerated type: AccessProperty.CLOUDDBZONE_PUBLIC:

    Returns AGCCloudDBZoneConfig

    AGCCloudDBZoneConfig Instance.

Generated using TypeDoc