mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
81 lines
2.3 KiB
Go
81 lines
2.3 KiB
Go
package visibility
|
|
|
|
import (
|
|
"context"
|
|
"reflect"
|
|
|
|
commonpb "go.temporal.io/api/common/v1"
|
|
"go.temporal.io/api/serviceerror"
|
|
"github.com/hanzoai/tasks/chasm"
|
|
"github.com/hanzoai/tasks/common/namespace"
|
|
"github.com/hanzoai/tasks/common/persistence/visibility/manager"
|
|
)
|
|
|
|
type ChasmVisibilityManager struct {
|
|
registry *chasm.Registry
|
|
visibilityMgr manager.VisibilityManager
|
|
}
|
|
|
|
var _ chasm.VisibilityManager = (*ChasmVisibilityManager)(nil)
|
|
|
|
func NewChasmVisibilityManager(
|
|
registry *chasm.Registry,
|
|
visibilityMgr manager.VisibilityManager,
|
|
) *ChasmVisibilityManager {
|
|
return &ChasmVisibilityManager{
|
|
registry: registry,
|
|
visibilityMgr: visibilityMgr,
|
|
}
|
|
}
|
|
|
|
func ChasmVisibilityManagerProvider(
|
|
registry *chasm.Registry,
|
|
visibilityMgr manager.VisibilityManager,
|
|
) chasm.VisibilityManager {
|
|
return NewChasmVisibilityManager(registry, visibilityMgr)
|
|
}
|
|
|
|
// ListExecutions implements the Engine interface for visibility queries.
|
|
func (e *ChasmVisibilityManager) ListExecutions(
|
|
ctx context.Context,
|
|
archetypeType reflect.Type,
|
|
request *chasm.ListExecutionsRequest,
|
|
) (*chasm.ListExecutionsResponse[*commonpb.Payload], error) {
|
|
archetypeID, ok := e.registry.ArchetypeIDOf(archetypeType)
|
|
if !ok {
|
|
return nil, serviceerror.NewInternal("unknown chasm component type: " + archetypeType.String())
|
|
}
|
|
|
|
visReq := &manager.ListChasmExecutionsRequest{
|
|
ArchetypeID: archetypeID,
|
|
NamespaceID: namespace.ID(request.NamespaceID),
|
|
Namespace: namespace.Name(request.NamespaceName),
|
|
PageSize: request.PageSize,
|
|
NextPageToken: request.NextPageToken,
|
|
Query: request.Query,
|
|
}
|
|
|
|
return e.visibilityMgr.ListChasmExecutions(ctx, visReq)
|
|
}
|
|
|
|
// CountExecutions implements the Engine interface for visibility queries.
|
|
func (e *ChasmVisibilityManager) CountExecutions(
|
|
ctx context.Context,
|
|
archetypeType reflect.Type,
|
|
request *chasm.CountExecutionsRequest,
|
|
) (*chasm.CountExecutionsResponse, error) {
|
|
archetypeID, ok := e.registry.ArchetypeIDOf(archetypeType)
|
|
if !ok {
|
|
return nil, serviceerror.NewInternal("unknown chasm component type: " + archetypeType.String())
|
|
}
|
|
|
|
visReq := &manager.CountChasmExecutionsRequest{
|
|
ArchetypeID: archetypeID,
|
|
NamespaceID: namespace.ID(request.NamespaceID),
|
|
Namespace: namespace.Name(request.NamespaceName),
|
|
Query: request.Query,
|
|
}
|
|
|
|
return e.visibilityMgr.CountChasmExecutions(ctx, visReq)
|
|
}
|