From 8662e92987c437f59d09896a247ec2b5d82c4528 Mon Sep 17 00:00:00 2001 From: Adelyn Breedlove Date: Mon, 28 Jan 2019 10:31:51 -0700 Subject: Publish docs updates --- lib/sharder.mli | 170 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 85 insertions(+), 85 deletions(-) (limited to 'lib/sharder.mli') diff --git a/lib/sharder.mli b/lib/sharder.mli index 0bc014b..92c4178 100644 --- a/lib/sharder.mli +++ b/lib/sharder.mli @@ -1,86 +1,86 @@ -(** Internal sharding manager. Most of this is accessed through {!Client}. *) - -open Core -open Async -open Websocket_async - -exception Invalid_Payload -exception Failure_to_Establish_Heartbeat - -type t - -(** Start the Sharder. This is called by {!Client.start}. *) -val start : - ?count:int -> - unit -> - t Deferred.t - -(** Module representing a single shard. *) -module Shard : sig - (** Representation of the state of a shard. *) - type shard = { - hb_interval: Time.Span.t Ivar.t; (** Time span between heartbeats, wrapped in an Ivar. *) - seq: int; (** Current sequence number *) - session: string option; (** Session id, if one exists. *) - pipe: Frame.t Pipe.Reader.t * Frame.t Pipe.Writer.t; (** Raw frame IO pipe used for websocket communications. *) - ready: unit Ivar.t; (** A simple Ivar indicating if the shard has received READY. *) - url: string; (** The websocket URL in use. *) - id: int * int; (** A tuple as expected by Discord. First element is the current shard index, second element is the total shard count. *) - _internal: Reader.t * Writer.t; - } - - (** Wrapper around an internal state, used to wrap {!shard}. *) - type 'a t = { - mutable state: 'a; - } - - (** Send a heartbeat to Discord. This is handled automatically. *) - val heartbeat : - shard -> - shard Deferred.t - - (** Set the status of the shard. *) - val set_status : - status:Yojson.Safe.json -> - shard -> - shard Deferred.t - - (** Request guild members for the shard's guild. Causes dispatch of multiple {{!Dispatch.members_chunk}member chunk} events. *) - val request_guild_members : - ?query:string -> - ?limit:int -> - guild:Snowflake.t -> - shard -> - shard Deferred.t - - (** Create a new shard *) - val create : - url:string -> - shards:int * int -> - unit -> - shard Deferred.t - - val shutdown_clean : shard -> unit Deferred.t -end - -(** Calls {!Shard.set_status} for each shard registered with the sharder. *) -val set_status : - status:Yojson.Safe.json -> - t -> - Shard.shard list Deferred.t - -(** Like {!set_status} but takes a function with a {{!Shard.shard}shard} as its parameter and {{!Yojson.Safe.json}json} for its return. *) -val set_status_with : - f:(Shard.shard -> Yojson.Safe.json) -> - t -> - Shard.shard list Deferred.t - -(** Calls {!Shard.request_guild_members} for each shard registered with the sharder. *) -val request_guild_members : - ?query:string -> - ?limit:int -> - guild:Snowflake.t -> - t -> - Shard.shard list Deferred.t - +(** Internal sharding manager. Most of this is accessed through {!Client}. *) + +open Core +open Async +open Websocket_async + +exception Invalid_Payload +exception Failure_to_Establish_Heartbeat + +type t + +(** Start the Sharder. This is called by {!Client.start}. *) +val start : + ?count:int -> + unit -> + t Deferred.t + +(** Module representing a single shard. *) +module Shard : sig + (** Representation of the state of a shard. *) + type shard = { + hb_interval: Time.Span.t Ivar.t; (** Time span between heartbeats, wrapped in an Ivar. *) + seq: int; (** Current sequence number *) + session: string option; (** Session id, if one exists. *) + pipe: Frame.t Pipe.Reader.t * Frame.t Pipe.Writer.t; (** Raw frame IO pipe used for websocket communications. *) + ready: unit Ivar.t; (** A simple Ivar indicating if the shard has received READY. *) + url: string; (** The websocket URL in use. *) + id: int * int; (** A tuple as expected by Discord. First element is the current shard index, second element is the total shard count. *) + _internal: Reader.t * Writer.t; + } + + (** Wrapper around an internal state, used to wrap {!shard}. *) + type 'a t = { + mutable state: 'a; + } + + (** Send a heartbeat to Discord. This is handled automatically. *) + val heartbeat : + shard -> + shard Deferred.t + + (** Set the status of the shard. *) + val set_status : + status:Yojson.Safe.json -> + shard -> + shard Deferred.t + + (** Request guild members for the shard's guild. Causes dispatch of multiple {{!Dispatch.members_chunk}member chunk} events. *) + val request_guild_members : + ?query:string -> + ?limit:int -> + guild:Snowflake.t -> + shard -> + shard Deferred.t + + (** Create a new shard *) + val create : + url:string -> + shards:int * int -> + unit -> + shard Deferred.t + + val shutdown_clean : shard -> unit Deferred.t +end + +(** Calls {!Shard.set_status} for each shard registered with the sharder. *) +val set_status : + status:Yojson.Safe.json -> + t -> + Shard.shard list Deferred.t + +(** Like {!set_status} but takes a function with a {{!Shard.shard}shard} as its parameter and {{!Yojson.Safe.json}json} for its return. *) +val set_status_with : + f:(Shard.shard -> Yojson.Safe.json) -> + t -> + Shard.shard list Deferred.t + +(** Calls {!Shard.request_guild_members} for each shard registered with the sharder. *) +val request_guild_members : + ?query:string -> + ?limit:int -> + guild:Snowflake.t -> + t -> + Shard.shard list Deferred.t + val shutdown_all : t -> unit list Deferred.t \ No newline at end of file -- cgit v1.2.3