This commit is contained in:
mr
2026-06-22 07:50:01 +02:00
parent 1425a31494
commit 58e97fbe74
10 changed files with 385 additions and 16 deletions
+23 -1
View File
@@ -40,6 +40,7 @@ const (
REFUND
DISCOUNT
SUBSCRIPTION
POLICY
)
var NOAPI = func() string {
@@ -104,6 +105,7 @@ var InnerDefaultAPI = [...]func() string{
NOAPI,
NOAPI,
NOAPI,
PEERSAPI,
}
// Bind the standard data name to the data type
@@ -138,6 +140,7 @@ var Str = [...]string{
"refund",
"discount",
"subscription",
"policy",
}
func FromString(comp string) int {
@@ -174,7 +177,7 @@ func DataTypeList() []DataType {
WORKFLOW, WORKFLOW_EXECUTION, WORKSPACE, PEER, COLLABORATIVE_AREA, RULE, BOOKING, WORKFLOW_HISTORY, WORKSPACE_HISTORY,
ORDER, PURCHASE_RESOURCE,
LIVE_DATACENTER, LIVE_STORAGE, BILL, NATIVE_TOOL, EXECUTION_VERIFICATION, ALLOWED_IMAGE, SERVICE_RESOURCE, DYNAMIC_RESOURCE, LIVE_SERVICE,
PAYMENT, REFUND, DISCOUNT, SUBSCRIPTION}
PAYMENT, REFUND, DISCOUNT, SUBSCRIPTION, POLICY}
}
type PropalgationMessage struct {
@@ -216,6 +219,19 @@ const (
// oc-discovery, which in turn notifies our oc-peer via ORG_PARTNER_EVENT to
// finalize the relation.
PB_ORG_PARTNER
// PB_WATCH_RESOURCE is emitted by oc-workspace when a non-self resource is
// stored in a workspace. oc-discovery contacts the creator peer to register
// the watching peerID in the creator's watcher cache so it receives future
// CREATE/DELETE events for that resource.
// Payload: { "creator_peer_id": "...", "resource_id": "..." }
PB_WATCH_RESOURCE
// PB_UNWATCH_RESOURCE is emitted by oc-workspace when a non-self resource is
// removed from all workspaces. oc-discovery contacts the creator peer to
// deregister the watching peerID from the creator's watcher cache.
// Payload: { "creator_peer_id": "...", "resource_id": "..." }
PB_UNWATCH_RESOURCE
)
func GetActionString(ss string) PubSubAction {
@@ -252,6 +268,10 @@ func GetActionString(ss string) PubSubAction {
return PB_SOURCE_PRESIGN
case "org_partner":
return PB_ORG_PARTNER
case "watch_resource":
return PB_WATCH_RESOURCE
case "unwatch_resource":
return PB_UNWATCH_RESOURCE
default:
return NONE
}
@@ -277,6 +297,8 @@ var path = []string{
"propagate", // 15 PB_PROPAGATE
"source_presign", // 16 PB_SOURCE_PRESIGN
"org_partner", // 17 PB_ORG_PARTNER
"watch_resource", // 18 PB_WATCH_RESOURCE
"unwatch_resource", // 19 PB_UNWATCH_RESOURCE
}
func (m PubSubAction) String() string {