Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed May 15, 2024
2 parents cefeeee + 4e69175 commit 80b73f9
Show file tree
Hide file tree
Showing 15 changed files with 1,027 additions and 59 deletions.
112 changes: 112 additions & 0 deletions cli/src/declarations/mission_control.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import type {ActorMethod} from '@dfinity/agent';
import type {IDL} from '@dfinity/candid';
import type {Principal} from '@dfinity/principal';

export type CanisterStatusType = {stopped: null} | {stopping: null} | {running: null};
export interface Controller {
updated_at: bigint;
metadata: Array<[string, string]>;
created_at: bigint;
scope: ControllerScope;
expires_at: [] | [bigint];
}
export type ControllerScope = {Write: null} | {Admin: null};
export interface CronJobStatusesConfig {
enabled: boolean;
cycles_threshold: [] | [bigint];
}
export interface DepositCyclesArgs {
cycles: bigint;
destination_id: Principal;
}
export interface Orbiter {
updated_at: bigint;
orbiter_id: Principal;
metadata: Array<[string, string]>;
created_at: bigint;
}
export type Result = {Ok: SegmentStatus} | {Err: string};
export interface Satellite {
updated_at: bigint;
metadata: Array<[string, string]>;
created_at: bigint;
satellite_id: Principal;
}
export interface SegmentCanisterSettings {
freezing_threshold: bigint;
controllers: Array<Principal>;
memory_allocation: bigint;
compute_allocation: bigint;
}
export interface SegmentCanisterStatus {
status: CanisterStatusType;
memory_size: bigint;
cycles: bigint;
settings: SegmentCanisterSettings;
idle_cycles_burned_per_day: bigint;
module_hash: [] | [Uint8Array | number[]];
}
export interface SegmentStatus {
id: Principal;
status: SegmentCanisterStatus;
metadata: [] | [Array<[string, string]>];
status_at: bigint;
}
export interface SegmentsStatuses {
orbiters: [] | [Array<Result>];
satellites: [] | [Array<Result>];
mission_control: Result;
}
export interface SetController {
metadata: Array<[string, string]>;
scope: ControllerScope;
expires_at: [] | [bigint];
}
export interface StatusesArgs {
mission_control_cycles_threshold: [] | [bigint];
orbiters: Array<[Principal, CronJobStatusesConfig]>;
satellites: Array<[Principal, CronJobStatusesConfig]>;
cycles_threshold: [] | [bigint];
}
export interface Tokens {
e8s: bigint;
}
export interface _SERVICE {
add_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
add_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
create_orbiter: ActorMethod<[[] | [string]], Orbiter>;
create_satellite: ActorMethod<[string], Satellite>;
del_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
del_orbiter: ActorMethod<[Principal, bigint], undefined>;
del_orbiters_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
del_satellite: ActorMethod<[Principal, bigint], undefined>;
del_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
deposit_cycles: ActorMethod<[DepositCyclesArgs], undefined>;
get_user: ActorMethod<[], Principal>;
list_mission_control_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
list_mission_control_statuses: ActorMethod<[], Array<[bigint, Result]>>;
list_orbiter_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result]>]>;
list_orbiters: ActorMethod<[], Array<[Principal, Orbiter]>>;
list_satellite_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result]>]>;
list_satellites: ActorMethod<[], Array<[Principal, Satellite]>>;
remove_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
remove_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
set_metadata: ActorMethod<[Array<[string, string]>], undefined>;
set_mission_control_controllers: ActorMethod<[Array<Principal>, SetController], undefined>;
set_orbiter: ActorMethod<[Principal, [] | [string]], Orbiter>;
set_orbiter_metadata: ActorMethod<[Principal, Array<[string, string]>], Orbiter>;
set_orbiters_controllers: ActorMethod<
[Array<Principal>, Array<Principal>, SetController],
undefined
>;
set_satellite_metadata: ActorMethod<[Principal, Array<[string, string]>], Satellite>;
set_satellites_controllers: ActorMethod<
[Array<Principal>, Array<Principal>, SetController],
undefined
>;
status: ActorMethod<[StatusesArgs], SegmentsStatuses>;
top_up: ActorMethod<[Principal, Tokens], undefined>;
version: ActorMethod<[], string>;
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: (args: {IDL: typeof IDL}) => IDL.Type[];
111 changes: 111 additions & 0 deletions cli/src/declarations/mission_control.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
type CanisterStatusType = variant { stopped; stopping; running };
type Controller = record {
updated_at : nat64;
metadata : vec record { text; text };
created_at : nat64;
scope : ControllerScope;
expires_at : opt nat64;
};
type ControllerScope = variant { Write; Admin };
type CronJobStatusesConfig = record {
enabled : bool;
cycles_threshold : opt nat64;
};
type DepositCyclesArgs = record { cycles : nat; destination_id : principal };
type Orbiter = record {
updated_at : nat64;
orbiter_id : principal;
metadata : vec record { text; text };
created_at : nat64;
};
type Result = variant { Ok : SegmentStatus; Err : text };
type Satellite = record {
updated_at : nat64;
metadata : vec record { text; text };
created_at : nat64;
satellite_id : principal;
};
type SegmentCanisterSettings = record {
freezing_threshold : nat;
controllers : vec principal;
memory_allocation : nat;
compute_allocation : nat;
};
type SegmentCanisterStatus = record {
status : CanisterStatusType;
memory_size : nat;
cycles : nat;
settings : SegmentCanisterSettings;
idle_cycles_burned_per_day : nat;
module_hash : opt vec nat8;
};
type SegmentStatus = record {
id : principal;
status : SegmentCanisterStatus;
metadata : opt vec record { text; text };
status_at : nat64;
};
type SegmentsStatuses = record {
orbiters : opt vec Result;
satellites : opt vec Result;
mission_control : Result;
};
type SetController = record {
metadata : vec record { text; text };
scope : ControllerScope;
expires_at : opt nat64;
};
type StatusesArgs = record {
mission_control_cycles_threshold : opt nat64;
orbiters : vec record { principal; CronJobStatusesConfig };
satellites : vec record { principal; CronJobStatusesConfig };
cycles_threshold : opt nat64;
};
type Tokens = record { e8s : nat64 };
service : () -> {
add_mission_control_controllers : (vec principal) -> ();
add_satellites_controllers : (vec principal, vec principal) -> ();
create_orbiter : (opt text) -> (Orbiter);
create_satellite : (text) -> (Satellite);
del_mission_control_controllers : (vec principal) -> ();
del_orbiter : (principal, nat) -> ();
del_orbiters_controllers : (vec principal, vec principal) -> ();
del_satellite : (principal, nat) -> ();
del_satellites_controllers : (vec principal, vec principal) -> ();
deposit_cycles : (DepositCyclesArgs) -> ();
get_user : () -> (principal) query;
list_mission_control_controllers : () -> (
vec record { principal; Controller },
) query;
list_mission_control_statuses : () -> (vec record { nat64; Result }) query;
list_orbiter_statuses : (principal) -> (
opt vec record { nat64; Result },
) query;
list_orbiters : () -> (vec record { principal; Orbiter }) query;
list_satellite_statuses : (principal) -> (
opt vec record { nat64; Result },
) query;
list_satellites : () -> (vec record { principal; Satellite }) query;
remove_mission_control_controllers : (vec principal) -> ();
remove_satellites_controllers : (vec principal, vec principal) -> ();
set_metadata : (vec record { text; text }) -> ();
set_mission_control_controllers : (vec principal, SetController) -> ();
set_orbiter : (principal, opt text) -> (Orbiter);
set_orbiter_metadata : (principal, vec record { text; text }) -> (Orbiter);
set_orbiters_controllers : (
vec principal,
vec principal,
SetController,
) -> ();
set_satellite_metadata : (principal, vec record { text; text }) -> (
Satellite,
);
set_satellites_controllers : (
vec principal,
vec principal,
SetController,
) -> ();
status : (StatusesArgs) -> (SegmentsStatuses);
top_up : (principal, Tokens) -> ();
version : () -> (text) query;
}
142 changes: 142 additions & 0 deletions cli/src/declarations/mission_control.idl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
export const idlFactory = ({IDL}) => {
const Orbiter = IDL.Record({
updated_at: IDL.Nat64,
orbiter_id: IDL.Principal,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
created_at: IDL.Nat64
});
const Satellite = IDL.Record({
updated_at: IDL.Nat64,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
created_at: IDL.Nat64,
satellite_id: IDL.Principal
});
const DepositCyclesArgs = IDL.Record({
cycles: IDL.Nat,
destination_id: IDL.Principal
});
const ControllerScope = IDL.Variant({
Write: IDL.Null,
Admin: IDL.Null
});
const Controller = IDL.Record({
updated_at: IDL.Nat64,
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
created_at: IDL.Nat64,
scope: ControllerScope,
expires_at: IDL.Opt(IDL.Nat64)
});
const CanisterStatusType = IDL.Variant({
stopped: IDL.Null,
stopping: IDL.Null,
running: IDL.Null
});
const SegmentCanisterSettings = IDL.Record({
freezing_threshold: IDL.Nat,
controllers: IDL.Vec(IDL.Principal),
memory_allocation: IDL.Nat,
compute_allocation: IDL.Nat
});
const SegmentCanisterStatus = IDL.Record({
status: CanisterStatusType,
memory_size: IDL.Nat,
cycles: IDL.Nat,
settings: SegmentCanisterSettings,
idle_cycles_burned_per_day: IDL.Nat,
module_hash: IDL.Opt(IDL.Vec(IDL.Nat8))
});
const SegmentStatus = IDL.Record({
id: IDL.Principal,
status: SegmentCanisterStatus,
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
status_at: IDL.Nat64
});
const Result = IDL.Variant({Ok: SegmentStatus, Err: IDL.Text});
const SetController = IDL.Record({
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
scope: ControllerScope,
expires_at: IDL.Opt(IDL.Nat64)
});
const CronJobStatusesConfig = IDL.Record({
enabled: IDL.Bool,
cycles_threshold: IDL.Opt(IDL.Nat64)
});
const StatusesArgs = IDL.Record({
mission_control_cycles_threshold: IDL.Opt(IDL.Nat64),
orbiters: IDL.Vec(IDL.Tuple(IDL.Principal, CronJobStatusesConfig)),
satellites: IDL.Vec(IDL.Tuple(IDL.Principal, CronJobStatusesConfig)),
cycles_threshold: IDL.Opt(IDL.Nat64)
});
const SegmentsStatuses = IDL.Record({
orbiters: IDL.Opt(IDL.Vec(Result)),
satellites: IDL.Opt(IDL.Vec(Result)),
mission_control: Result
});
const Tokens = IDL.Record({e8s: IDL.Nat64});
return IDL.Service({
add_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
add_satellites_controllers: IDL.Func([IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)], [], []),
create_orbiter: IDL.Func([IDL.Opt(IDL.Text)], [Orbiter], []),
create_satellite: IDL.Func([IDL.Text], [Satellite], []),
del_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
del_orbiter: IDL.Func([IDL.Principal, IDL.Nat], [], []),
del_orbiters_controllers: IDL.Func([IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)], [], []),
del_satellite: IDL.Func([IDL.Principal, IDL.Nat], [], []),
del_satellites_controllers: IDL.Func([IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)], [], []),
deposit_cycles: IDL.Func([DepositCyclesArgs], [], []),
get_user: IDL.Func([], [IDL.Principal], ['query']),
list_mission_control_controllers: IDL.Func(
[],
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
['query']
),
list_mission_control_statuses: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Nat64, Result))], ['query']),
list_orbiter_statuses: IDL.Func(
[IDL.Principal],
[IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Nat64, Result)))],
['query']
),
list_orbiters: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Orbiter))], ['query']),
list_satellite_statuses: IDL.Func(
[IDL.Principal],
[IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Nat64, Result)))],
['query']
),
list_satellites: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Satellite))], ['query']),
remove_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
remove_satellites_controllers: IDL.Func(
[IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)],
[],
[]
),
set_metadata: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], [], []),
set_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal), SetController], [], []),
set_orbiter: IDL.Func([IDL.Principal, IDL.Opt(IDL.Text)], [Orbiter], []),
set_orbiter_metadata: IDL.Func(
[IDL.Principal, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
[Orbiter],
[]
),
set_orbiters_controllers: IDL.Func(
[IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal), SetController],
[],
[]
),
set_satellite_metadata: IDL.Func(
[IDL.Principal, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
[Satellite],
[]
),
set_satellites_controllers: IDL.Func(
[IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal), SetController],
[],
[]
),
status: IDL.Func([StatusesArgs], [SegmentsStatuses], []),
top_up: IDL.Func([IDL.Principal, Tokens], [], []),
version: IDL.Func([], [IDL.Text], ['query'])
});
};
export const init = ({IDL}) => {
return [];
};
Loading

0 comments on commit 80b73f9

Please sign in to comment.