MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / newSlaveNode

Function newSlaveNode

pkg/cluster/node.go:238–251  ·  view source on GitHub ↗
(ctx context.Context, model *ent.Node, config conf.ConfigProvider, settings setting.Provider)

Source from the content-addressed store, hash-verified

236}
237
238func newSlaveNode(ctx context.Context, model *ent.Node, config conf.ConfigProvider, settings setting.Provider) *slaveNode {
239 siteBasic := settings.SiteBasic(ctx)
240 return &slaveNode{
241 nodeBase: nodeBase{
242 model: model,
243 },
244 client: request.NewClient(config,
245 request.WithCorrelationID(),
246 request.WithSlaveMeta(model.ID),
247 request.WithMasterMeta(siteBasic.ID, settings.SiteURL(setting.UseFirstSiteUrl(ctx)).String()),
248 request.WithCredential(auth.HMACAuth{[]byte(model.SlaveKey)}, int64(settings.SlaveRequestSignTTL(ctx))),
249 request.WithEndpoint(model.Server)),
250 }
251}
252
253func (n *slaveNode) CreateTask(ctx context.Context, taskType string, state string) (int, error) {
254 reqBody, err := json.Marshal(&CreateSlaveTask{

Callers 1

newNodeFunction · 0.85

Calls 11

NewClientFunction · 0.92
WithCorrelationIDFunction · 0.92
WithSlaveMetaFunction · 0.92
WithMasterMetaFunction · 0.92
UseFirstSiteUrlFunction · 0.92
WithCredentialFunction · 0.92
WithEndpointFunction · 0.92
SiteBasicMethod · 0.65
StringMethod · 0.65
SiteURLMethod · 0.65
SlaveRequestSignTTLMethod · 0.65

Tested by

no test coverage detected