save works

This commit is contained in:
Rongsong Shen 2026-03-03 16:49:26 +08:00
parent f4b1ba4cd7
commit acfbec875b
51 changed files with 622 additions and 1175 deletions

View file

@ -161,7 +161,31 @@ static typeinfo_t worker_type = {
worker_t* makeWorker(var workermgr, xce_worker_t* w)
{
worker_t* worker = makeInstance(&worker_type, w);
/* fIXME */
worker_t* worker = NULL;
int rc = 0;
rc = key_find(workermgr, (void*)w->name, (void**)&worker);
if ((rc < 0) && (rc != -ENOENT)) {
errno = -rc;
return NULL;
}
if (rc > 0) {
errno = EEXIST;
return NULL;
}
worker = makeInstance(&worker_type, w);
if (worker != NULL) {
reference(worker);
rc = key_add(workermgr, (void*)worker->host.name, (void*)worker);
if (rc < 0) {
destroy(worker);
errno = -rc;
return NULL;
}
}
return worker;
}