G
G
Golem SDK
Search…
⌃K

Class: DemandBuilder

yajsapi / Exports / props/builder / DemandBuilder

Class: 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': []}

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DemandBuilder()
Defined in

Properties

_constraints

_constraints: string[]
Defined in

_properties

_properties: Object
Defined in

Methods

add

add(m): void
Parameters
Name
Type
m
any
Returns
void
Defined in

constraints

constraints(): string
Returns
string
Defined in

ensure

ensure(constraint): void
Parameters
Name
Type
constraint
string
Returns
void
Defined in

properties

properties(): object
Returns
object
Defined in

subscribe

subscribe(market): Promise<Subscription>
Parameters
Name
Type
market
Market
Returns
Promise<Subscription>
Defined in