Skip to content

Commit

Permalink
PR feedback: no typedef for jsOptionsPullSubscribeAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Aug 24, 2024
1 parent 51a5f53 commit 2c340a9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
76 changes: 37 additions & 39 deletions src/nats.h
Original file line number Diff line number Diff line change
Expand Up @@ -1241,44 +1241,6 @@ typedef void (*natsFetchCompleteHandler)(natsConnection *nc, natsSubscription *s
*/
typedef bool (*natsFetchNextHandler)(int *messages, int64_t *bytes, natsSubscription *sub, void *closure);

typedef struct jsOptionsPullSubscribeAsync
{
// Lifetime of the subscription (completes when any one of the
// targets is reached).
int64_t Timeout; // in milliseconds
int MaxMessages;
int64_t MaxBytes;

// If NoWait is set, the subscription will receive the messages
// already stored on the server subject to the limits, but will
// not wait for more messages.
bool NoWait;

// Fetch complete handler that receives the exit status code,
// the subscription's Complete handler is also invoked, but does
// not have the status code.
natsFetchCompleteHandler CompleteHandler;
void *CompleteHandlerClosure;

// Have server sends heartbeats at this interval to help detect
// communication failures.
int64_t Heartbeat; // in milliseconds

// Options to control automatic Fetch flow control. The number
// of messages to ask for in a single request, and if we should
// try to fetch ahead, KeepAhead more than we need to finish the
// current request. Fetch this many messages ahead of time.
int FetchSize;
int KeepAhead;

// Manual fetch flow control. If provided gets called before
// each message is deliverered to msgCB, and overrides the
// default algorithm for sending Next requests.
natsFetchNextHandler NextHandler;
void *NextHandlerClosure;

} jsOptionsPullSubscribeAsync;

/**
* JetStream context options.
*
Expand Down Expand Up @@ -1316,7 +1278,43 @@ typedef struct jsOptions

} PublishAsync;

jsOptionsPullSubscribeAsync PullSubscribeAsync;
struct jsOptionsPullSubscribeAsync
{
// Lifetime of the subscription (completes when any one of the
// targets is reached).
int64_t Timeout; // in milliseconds
int MaxMessages;
int64_t MaxBytes;

// If NoWait is set, the subscription will receive the messages
// already stored on the server subject to the limits, but will
// not wait for more messages.
bool NoWait;

// Fetch complete handler that receives the exit status code,
// the subscription's Complete handler is also invoked, but does
// not have the status code.
natsFetchCompleteHandler CompleteHandler;
void *CompleteHandlerClosure;

// Have server sends heartbeats at this interval to help detect
// communication failures.
int64_t Heartbeat; // in milliseconds

// Options to control automatic Fetch flow control. The number
// of messages to ask for in a single request, and if we should
// try to fetch ahead, KeepAhead more than we need to finish the
// current request. Fetch this many messages ahead of time.
int FetchSize;
int KeepAhead;

// Manual fetch flow control. If provided gets called before
// each message is deliverered to msgCB, and overrides the
// default algorithm for sending Next requests.
natsFetchNextHandler NextHandler;
void *NextHandlerClosure;

} PullSubscribeAsync;

/**
* Advanced stream options
Expand Down
2 changes: 1 addition & 1 deletion src/natsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ struct __jsCtx

typedef struct __jsFetch
{
jsOptionsPullSubscribeAsync opts;
struct jsOptionsPullSubscribeAsync opts;

natsStatus status;

Expand Down

0 comments on commit 2c340a9

Please sign in to comment.