QCloudCredentailFenceQueue Class Reference

Inherits from NSObject
Declared in QCloudCredentailFenceQueue.h

Overview

使用类似栅栏的机制,更新秘钥。可以是临时密钥,也可以是永久密钥。在没有合法密钥的时候,所有的请求会阻塞在队列里面。直到获取到一个合法密钥,或者获取出错。

示例

@code

 - (void) fenceQueue:(QCloudCredentailFenceQueue *)queue requestCreatorWithContinue:(QCloudCredentailFenceQueueContinue)continueBlock
 {
    QCloudCredential* credential = [QCloudCredential new];
    credential.secretID = @"secretID";
    credential.secretKey = @"secretKey";
     //签名过期时间
    credential.experationDate = [NSDate dateWithTimeIntervalSince1970:1504183628];
    credential.token = @"token";
    QCloudAuthentationV5Creator* creator = [[QCloudAuthentationV5Creator alloc] initWithCredential:credential];
    continueBlock(creator, nil);
 }

  delegate

执行委托

@property (nonatomic, weak) id<QCloudCredentailFenceQueueDelegate> delegate

Declared In

QCloudCredentailFenceQueue.h

  timeout

获取新的密钥的超时时间。如果您在超时时间内没有返回任何结果数据,则将会将认为获取任务失败。失败后,将会通知所有需要签名的调用方:失败。 @default 120s

@property (nonatomic, assign) NSTimeInterval timeout

Declared In

QCloudCredentailFenceQueue.h

  authentationCreator

当前获得的密钥

@property (nonatomic, strong, readonly) QCloudAuthentationCreator *authentationCreator

Declared In

QCloudCredentailFenceQueue.h

– performAction:

执行一个需要密钥的方法,如果密钥存在则直接传给Block。如果不存在,则会触发栅栏机制。该请求被缓存在队列中,同时触发请求密钥(如果可以)。直到请求到密钥或者请求密钥失败。

- (void)performAction:(void ( ^ ) ( QCloudAuthentationCreator *creator , NSError *error ))action

Parameters

action

一个需要密钥的方法

Declared In

QCloudCredentailFenceQueue.h