MCPcopy Index your code
hub / github.com/coder/coder / SyncWant

Method SyncWant

agent/agentsocket/service.go:84–101  ·  view source on GitHub ↗

SyncWant declares a dependency between units.

(_ context.Context, req *proto.SyncWantRequest)

Source from the content-addressed store, hash-verified

82
83// SyncWant declares a dependency between units.
84func (s *DRPCAgentSocketService) SyncWant(_ context.Context, req *proto.SyncWantRequest) (*proto.SyncWantResponse, error) {
85 if s.unitManager == nil {
86 return nil, xerrors.Errorf("cannot add dependency: %w", ErrUnitManagerNotAvailable)
87 }
88
89 unitID := unit.ID(req.Unit)
90 dependsOnID := unit.ID(req.DependsOn)
91
92 if err := s.unitManager.Register(unitID); err != nil && !errors.Is(err, unit.ErrUnitAlreadyRegistered) {
93 return nil, xerrors.Errorf("cannot add dependency: %w", err)
94 }
95
96 if err := s.unitManager.AddDependency(unitID, dependsOnID, unit.StatusComplete); err != nil {
97 return nil, xerrors.Errorf("cannot add dependency: %w", err)
98 }
99
100 return &proto.SyncWantResponse{}, nil
101}
102
103// SyncComplete marks a unit as complete in the dependency graph.
104func (s *DRPCAgentSocketService) SyncComplete(_ context.Context, req *proto.SyncCompleteRequest) (*proto.SyncCompleteResponse, error) {

Callers

nothing calls this directly

Calls 5

IDTypeAlias · 0.92
AddDependencyMethod · 0.80
ErrorfMethod · 0.45
RegisterMethod · 0.45
IsMethod · 0.45

Tested by

no test coverage detected