forked from aws-amplify/aws-sdk-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAWSAbstractKinesisRecorder.h
89 lines (71 loc) · 3.78 KB
/
AWSAbstractKinesisRecorder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
// http://aws.amazon.com/apache2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//
#import <Foundation/Foundation.h>
#import <AWSCore/AWSService.h>
/**
`AWSAbstractKinesisRecorder` is an abstract class. You should not instantiate this class directly. Instead use its concrete subclasses `AWSKinesisRecorder` and `AWSFirehoseRecorder`.
*/
@interface AWSAbstractKinesisRecorder : AWSService
/**
The number of bytes currently used to store AWSKinesisPutRecordInput objects on disk.
*/
@property (nonatomic, assign, readonly) NSUInteger diskBytesUsed;
/**
The threshold of disk bytes for notification. When exceeded, `saveRecord:streamName:` posts AWSKinesisRecorderByteThresholdReachedNotification. The default is 0 meaning it will not post the notification.
@discussion The `notificationByteThreshold` should be smaller than `diskByteLimit`.
*/
@property (nonatomic, assign) NSUInteger notificationByteThreshold;
/**
The limit of the disk cache size in bytes. When exceeded, older requests will be discarded. Setting this value to 0.0 meaning no practical limit. The default value is 5MB.
*/
@property (nonatomic, assign) NSUInteger diskByteLimit;
/**
The age limit of the cached requests. When exceeded, requests older than the specified age will be discarded. Setting this value to 0 meaning no practical limit. The default is no age limit.
*/
@property (nonatomic, assign) NSTimeInterval diskAgeLimit;
/**
The maxium batch data size in bytes. The default value is 512KB. The maximum is 4MB.
*/
@property (nonatomic, assign) NSUInteger batchRecordsByteLimit;
/**
Saves a record to local storage to be sent later. The record will be submitted to the streamName provided with a randomly generated partition key to ensure equal distribution across shards.
@param data The data to send to Amazon Kinesis. It needs to be smaller than 256KB.
@param streamName The stream name for Amazon Kinesis.
@return AWSTask - task.result is always nil.
*/
- (AWSTask *)saveRecord:(NSData *)data
streamName:(NSString *)streamName;
/**
Note: The partitionKey is used to distribute records between shards, therefore using the same partitionKey across multiple calls could cause provisioned throughput to be exceeded on one shard.
Saves a record to local storage to be sent later. The record will be submitted to the streamName provided with a specified partition key to ensure equal distribution across shards.
@param data The data to send to Amazon Kinesis. It needs to be smaller than 256KB.
@param streamName The stream name for Amazon Kinesis.
@param partitionKey The partition key for Amazon Kinesis.
@return AWSTask - task.result is always nil.
*/
- (AWSTask *)saveRecord:(NSData *)data
streamName:(NSString *)streamName
partitionKey:(NSString *)partitionKey;
/**
Submits all locally saved requests to Amazon Kinesis. Requests that are successfully sent will be deleted from the device. Requests that fail due to the device being offline will stop the submission process and be kept. Requests that fail due to other reasons (such as the request being invalid) will be deleted.
@return AWSTask - task.result is always nil.
*/
- (AWSTask *)submitAllRecords;
/**
Removes all requests saved to disk.
@return AWSTask - task.result is always nil.
*/
- (AWSTask *)removeAllRecords;
@end