Skip to content

Commit

Permalink
Get bridge data bassed through
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushisource committed Nov 27, 2024
1 parent b992dd4 commit 2f99e81
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 147 deletions.
13 changes: 2 additions & 11 deletions src/Temporalio/Api/Activity/V1/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ static MessageReflection() {

}
#region Messages
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class ActivityOptions : pb::IMessage<ActivityOptions>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down Expand Up @@ -396,11 +395,7 @@ public void MergeFrom(pb::CodedInputStream input) {
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
Expand Down Expand Up @@ -457,11 +452,7 @@ public void MergeFrom(pb::CodedInputStream input) {
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
if ((tag & 7) == 4) {
// Abort on any end group tag.
return;
}
switch(tag) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
Expand Down
28 changes: 14 additions & 14 deletions src/Temporalio/Bridge/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/Temporalio/Bridge/Interop/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -942,22 +942,22 @@ internal partial struct _Anonymous_e__Union
}
}

internal partial struct SlotMarkUsedCtx
internal unsafe partial struct SlotMarkUsedCtx
{
[NativeTypeName("struct SlotInfo")]
public SlotInfo slot_info;

[NativeTypeName("bool")]
public byte slot_permit;
[NativeTypeName("const void *")]
public void* slot_permit;
}

internal unsafe partial struct SlotReleaseCtx
{
[NativeTypeName("const struct SlotInfo *")]
public SlotInfo* slot_info;

[NativeTypeName("bool")]
public byte slot_permit;
[NativeTypeName("const void *")]
public void* slot_permit;
}

internal static unsafe partial class Methods
Expand Down
129 changes: 72 additions & 57 deletions src/Temporalio/Bridge/include/temporal-sdk-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,85 @@ typedef struct ResourceBasedSlotSupplier {
struct ResourceBasedTunerOptions tuner_options;
} ResourceBasedSlotSupplier;

typedef struct SlotReserveCtx {
enum SlotKindType slot_type;
struct ByteArrayRef task_queue;
struct ByteArrayRef worker_identity;
struct ByteArrayRef worker_build_id;
bool is_sticky;
} SlotReserveCtx;

typedef void (*CustomReserveSlotCallback)(struct SlotReserveCtx ctx);

typedef void (*CustomTryReserveSlotCallback)(struct SlotReserveCtx ctx);

typedef enum SlotInfo_Tag {
WorkflowSlotInfo,
ActivitySlotInfo,
LocalActivitySlotInfo,
} SlotInfo_Tag;

typedef struct WorkflowSlotInfo_Body {
struct ByteArrayRef workflow_type;
bool is_sticky;
} WorkflowSlotInfo_Body;

typedef struct ActivitySlotInfo_Body {
struct ByteArrayRef activity_type;
} ActivitySlotInfo_Body;

typedef struct LocalActivitySlotInfo_Body {
struct ByteArrayRef activity_type;
} LocalActivitySlotInfo_Body;

typedef struct SlotInfo {
SlotInfo_Tag tag;
union {
WorkflowSlotInfo_Body workflow_slot_info;
ActivitySlotInfo_Body activity_slot_info;
LocalActivitySlotInfo_Body local_activity_slot_info;
};
} SlotInfo;

typedef struct SlotMarkUsedCtx {
struct SlotInfo slot_info;
/**
* User instance of a slot permit.
*/
const void *slot_permit;
} SlotMarkUsedCtx;

typedef void (*CustomMarkSlotUsedCallback)(struct SlotMarkUsedCtx ctx);

typedef struct SlotReleaseCtx {
const struct SlotInfo *slot_info;
/**
* User instance of a slot permit.
*/
const void *slot_permit;
} SlotReleaseCtx;

typedef void (*CustomReleaseSlotCallback)(struct SlotReleaseCtx ctx);

typedef struct CustomSlotSupplier_WorkflowSlotKind {
const void *csharp_obj;
CustomReserveSlotCallback reserve;
CustomTryReserveSlotCallback try_reserve;
CustomMarkSlotUsedCallback mark_used;
CustomReleaseSlotCallback release;
} CustomSlotSupplier_WorkflowSlotKind;

typedef struct CustomSlotSupplier_ActivitySlotKind {
const void *csharp_obj;
CustomReserveSlotCallback reserve;
CustomTryReserveSlotCallback try_reserve;
CustomMarkSlotUsedCallback mark_used;
CustomReleaseSlotCallback release;
} CustomSlotSupplier_ActivitySlotKind;

typedef struct CustomSlotSupplier_LocalActivitySlotKind {
const void *csharp_obj;
CustomReserveSlotCallback reserve;
CustomTryReserveSlotCallback try_reserve;
CustomMarkSlotUsedCallback mark_used;
CustomReleaseSlotCallback release;
} CustomSlotSupplier_LocalActivitySlotKind;

typedef enum CustomSlotSupplierOfType_Tag {
Expand Down Expand Up @@ -493,52 +562,6 @@ typedef struct WorkerReplayPushResult {
const struct ByteArray *fail;
} WorkerReplayPushResult;

typedef struct SlotReserveCtx {
enum SlotKindType slot_type;
struct ByteArrayRef task_queue;
struct ByteArrayRef worker_identity;
struct ByteArrayRef worker_build_id;
bool is_sticky;
} SlotReserveCtx;

typedef enum SlotInfo_Tag {
WorkflowSlotInfo,
ActivitySlotInfo,
LocalActivitySlotInfo,
} SlotInfo_Tag;

typedef struct WorkflowSlotInfo_Body {
struct ByteArrayRef workflow_type;
bool is_sticky;
} WorkflowSlotInfo_Body;

typedef struct ActivitySlotInfo_Body {
struct ByteArrayRef activity_type;
} ActivitySlotInfo_Body;

typedef struct LocalActivitySlotInfo_Body {
struct ByteArrayRef activity_type;
} LocalActivitySlotInfo_Body;

typedef struct SlotInfo {
SlotInfo_Tag tag;
union {
WorkflowSlotInfo_Body workflow_slot_info;
ActivitySlotInfo_Body activity_slot_info;
LocalActivitySlotInfo_Body local_activity_slot_info;
};
} SlotInfo;

typedef struct SlotMarkUsedCtx {
struct SlotInfo slot_info;
bool slot_permit;
} SlotMarkUsedCtx;

typedef struct SlotReleaseCtx {
const struct SlotInfo *slot_info;
bool slot_permit;
} SlotReleaseCtx;

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
Expand Down Expand Up @@ -697,14 +720,6 @@ struct WorkerReplayPushResult worker_replay_push(struct Worker *worker,
struct ByteArrayRef workflow_id,
struct ByteArrayRef history);

extern void ReserveSlot(const void *csharp_obj, struct SlotReserveCtx ctx);

extern void TryReserveSlot(const void *csharp_obj, struct SlotReserveCtx ctx);

extern void MarkSlotUsed(const void *csharp_obj, struct SlotMarkUsedCtx ctx);

extern void ReleaseSlot(const void *csharp_obj, struct SlotReleaseCtx ctx);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
Loading

0 comments on commit 2f99e81

Please sign in to comment.