tests: add subscription method coverage
This resulted in some minor binding fixes. In theory, all the main wrapped API endpoints are now covered.
This commit is contained in:
@@ -423,7 +423,7 @@ pub const Connection = opaque {
|
||||
) Error!*Subscription {
|
||||
var sub: *Subscription = undefined;
|
||||
|
||||
const status = Status.fromInt(nats_c.natsConnection_QueueSubscribe(
|
||||
const status = Status.fromInt(nats_c.natsConnection_QueueSubscribeTimeout(
|
||||
@ptrCast(&sub),
|
||||
@ptrCast(self),
|
||||
subject.ptr,
|
||||
@@ -443,7 +443,7 @@ pub const Connection = opaque {
|
||||
) Error!*Subscription {
|
||||
var sub: *Subscription = undefined;
|
||||
|
||||
const status = Status.fromInt(nats_c.natsConnection_SubscribeSync(
|
||||
const status = Status.fromInt(nats_c.natsConnection_QueueSubscribeSync(
|
||||
@ptrCast(&sub),
|
||||
@ptrCast(self),
|
||||
subject.ptr,
|
||||
|
@@ -28,19 +28,19 @@ const Status = err_.Status;
|
||||
|
||||
const thunk = @import("./thunk.zig");
|
||||
|
||||
pub const MessageCount = struct {
|
||||
messages: c_int = 0,
|
||||
bytes: c_int = 0,
|
||||
};
|
||||
|
||||
pub const SubscriptionStats = struct {
|
||||
pending: MessageCount = .{},
|
||||
max_pending: MessageCount = .{},
|
||||
delivered_messages: i64 = 0,
|
||||
dropped_messages: i64 = 0,
|
||||
};
|
||||
|
||||
pub const Subscription = opaque {
|
||||
pub const MessageCount = struct {
|
||||
messages: c_int = 0,
|
||||
bytes: c_int = 0,
|
||||
};
|
||||
|
||||
pub const SubscriptionStats = struct {
|
||||
pending: MessageCount = .{},
|
||||
max_pending: MessageCount = .{},
|
||||
delivered_messages: i64 = 0,
|
||||
dropped_messages: i64 = 0,
|
||||
};
|
||||
|
||||
pub fn isValid(self: *Subscription) bool {
|
||||
return nats_c.natsSubscription_IsValid(@ptrCast(self));
|
||||
}
|
||||
@@ -84,7 +84,7 @@ pub const Subscription = opaque {
|
||||
// invalid/closed subscriptions return null. should we convert that into an
|
||||
// error? could return error.InvalidSubscription
|
||||
const result = nats_c.natsSubscription_GetSubject(@ptrCast(self)) orelse return null;
|
||||
return std.mem.spanTo(u8, result, 0);
|
||||
return std.mem.sliceTo(result, 0);
|
||||
}
|
||||
|
||||
pub fn setPendingLimits(self: *Subscription, limit: MessageCount) Error!void {
|
||||
|
Reference in New Issue
Block a user