yajsapi / Exports / props/builder / DemandBuilder
props/builder.DemandBuilder
Builds an object of properties and constraints from high-level models.
description
The object represents a Demand object, which is later matched by the new Golem's market implementation against Offers coming from providers to find those providers who can satisfy the requestor's demand.
example
import dayjs from "dayjs"
import { props } from "yajsapi"
dayjs.extend(utc);
const { Activity, DemandBuilder, NodeInfo } = props;
let builder = new DemandBuilder();
builder.add(NodeInfo("testnet", "a node"));
let act = new yp.Activity();
act.expiration.value = dayjs().utc().unix() * 1000;
builder.add(act);
console.log(builder);
// Output:
// {'properties':
// {'golem.node.id.name': 'a node',
// 'golem.node.debug.subnet': 'testnet',
// 'golem.srv.comp.expiration': 1601655628772},
// 'constraints': []}
• new DemandBuilder()
Defined in
• _constraints: string
[]
Defined in
• _properties: Object
Defined in
▸ add(m
): void
Parameters
Name | Type |
---|---|
m |
any |
Returns
void
Defined in
▸ constraints(): string
Returns
string
Defined in
▸ ensure(constraint
): void
Parameters
Name | Type |
---|---|
constraint |
string |
Returns
void
Defined in
▸ properties(): object
Returns
object
Defined in
▸ subscribe(market
): Promise
<Subscription>
Parameters
Name | Type |
---|---|
market |
Market |
Returns
Promise
<Subscription>
Defined in