Skip to content

Latest commit

 

History

History
162 lines (94 loc) · 3.47 KB

props_builder.demandbuilder.md

File metadata and controls

162 lines (94 loc) · 3.47 KB

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

yajsapi/props/builder.ts:35

Properties

_constraints

_constraints: string[]

Defined in

yajsapi/props/builder.ts:35

_properties

_properties: Object

Defined in

yajsapi/props/builder.ts:34

Methods

add

add(m): void

Parameters

Name Type
m any

Returns

void

Defined in

yajsapi/props/builder.ts:66

constraints

constraints(): string

Returns

string

Defined in

yajsapi/props/builder.ts:47

ensure

ensure(constraint): void

Parameters

Name Type
constraint string

Returns

void

Defined in

yajsapi/props/builder.ts:61

properties

properties(): object

Returns

object

Defined in

yajsapi/props/builder.ts:42

subscribe

subscribe(market): Promise<Subscription>

Parameters

Name Type
market Market

Returns

Promise<Subscription>

Defined in

yajsapi/props/builder.ts:90