Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:20
sbroker
sbroker-1.0.0-git.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sbroker-1.0.0-git.patch of Package sbroker
diff --git a/README.md b/README.md index 19cce1c..2ed13c7 100644 --- a/README.md +++ b/README.md @@ -116,14 +116,14 @@ expensive resource and is unlikely to be ready immediately. If workers are started early then the pool will be less likely to have no workers available. However the same pools that start workers "too late" also start new workers for -every client that trys to checkout when no workers are available. However old +every client that tries to checkout when no workers are available. However old workers will become available again, perhaps before new workers are ready. This often leads to too many workers getting started and wastes resources until they are reaped for being idle. If workers are started at intervals then temporary bursts would not start too many workers but persistent increases would still cause adequate growth. -Therefore we want workers to be started when worker availablity is running low +Therefore we want workers to be started when worker availability is running low but with intervals between starting workers. This can be achieved by sampling the worker queue at intervals and starting a worker based on the reading. This is the load regulator pattern, where the concurrency limit of tasks changes @@ -145,7 +145,19 @@ user defined supervisors. License ------- -This project is licensed under the Apache License, 2.0. +Copyright 2014 James Fish + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. Roadmap ------- diff --git a/rebar.config b/rebar.config index e809a20..a936737 100644 --- a/rebar.config +++ b/rebar.config @@ -10,3 +10,5 @@ {git, "https://github.com/ferd/cth_readable.git", {ref, "0fc53d1"}}} ]}]} ]}. + +{dialyzer, [{warnings, [unknown]}]}. diff --git a/src/sbroker.erl b/src/sbroker.erl index 9b7e9ee..767bf12 100644 --- a/src/sbroker.erl +++ b/src/sbroker.erl @@ -28,8 +28,8 @@ %% %% There are two functions to join a queue: `ask/1' and `ask_r/1'. Processes %% that call `ask/1' are matched against processes that call `ask_r/1'. If no -%% match is immediately avaliable a process is queued in the relevant queue -%% until a match becomes avaliable. If queue management is used processes may be +%% match is immediately available a process is queued in the relevant queue +%% until a match becomes available. If queue management is used processes may be %% dropped without a match. %% %% Processes calling `ask/1' try to match with/dequeue a process in the `ask_r' @@ -149,6 +149,7 @@ -type handler_spec() :: {module(), any()}. -export_type([broker/0]). +-export_type([name/0]). -export_type([handler_spec/0]). -callback init(Args :: any()) -> @@ -672,7 +673,7 @@ timeout(Broker) -> %% gen api -%% Inside the broker an ask_r request is refered to as a bid to make the +%% Inside the broker an ask_r request is referred to as a bid to make the %% difference between ask and ask_r clearer. %% @private diff --git a/src/sbroker_user.erl b/src/sbroker_user.erl index 2d4f95c..1b7805d 100644 --- a/src/sbroker_user.erl +++ b/src/sbroker_user.erl @@ -71,7 +71,7 @@ %% `brokers' or `{error, Reason}' if the broker fails to start with reason %% `Reason'. -spec start(Name) -> {ok, Pid} | {error, Reason} when - Name :: sbroker:broker(), + Name :: sbroker:name(), Pid :: pid() | undefined, Reason :: term(). start(Name) -> @@ -89,7 +89,7 @@ start(Name) -> %% `brokers' or `{error, Reason}' if the broker fails to start with reason %% `Reason'. -spec restart(Name) -> {ok, Pid} | {error, Reason} when - Name :: sbroker:broker(), + Name :: sbroker:name(), Pid :: pid() | undefined, Reason :: term(). restart(Name) -> @@ -105,7 +105,7 @@ restart(Name) -> %% %% Returns `ok' once the broker is terminated, otherwise `{error, not_found}'. -spec terminate(Name) -> ok | {error, not_found} when - Name :: sbroker:broker(). + Name :: sbroker:name(). terminate(Name) -> sbroker_user_sup:terminate(?MODULE, Name). @@ -120,7 +120,7 @@ terminate(Name) -> %% Returns `ok' on successfully deleting the regulator, otherwise %% `{error, Reason}' where `Reason' is reason for the error. -spec delete(Name) -> ok | {error, Reason} when - Name :: sbroker:broker(), + Name :: sbroker:name(), Reason :: running | restarting | not_found. delete(Name) -> sbroker_user_sup:delete(?MODULE, Name). diff --git a/src/sbroker_user_sup.erl b/src/sbroker_user_sup.erl index 582eb71..0460077 100644 --- a/src/sbroker_user_sup.erl +++ b/src/sbroker_user_sup.erl @@ -39,7 +39,7 @@ -spec start(Module, Name) -> {ok, Pid} | {error, Reason} when Module :: sbroker_user | sregulator_user, - Name :: sbrokers:broker() | regulator:regulator(), + Name :: sbroker:name() | sregulator:name(), Pid :: pid() | undefined, Reason :: term(). start(Module, Name) -> @@ -47,7 +47,7 @@ start(Module, Name) -> -spec restart(Module, Name) -> {ok, Pid} | {error, Reason} when Module :: sbroker_user | sregulator_user, - Name :: sbrokers:broker() | regulator:regulator(), + Name :: sbroker:name() | sregulator:name(), Pid :: pid() | undefined, Reason :: term(). restart(Module, Name) -> @@ -55,13 +55,13 @@ restart(Module, Name) -> -spec terminate(Module, Name) -> ok | {error, not_found} when Module :: sbroker_user | sregulator_user, - Name :: sbrokers:broker() | regulator:regulator(). + Name :: sbroker:name() | sregulator:name(). terminate(Module, Name) -> supervisor:terminate_child(?MODULE, {Module, Name}). -spec delete(Module, Name) -> ok | {error, Reason} when Module :: sbroker_user | sregulator_user, - Name :: sbrokers:broker() | regulator:regulator(), + Name :: sbroker:name() | sregulator:name(), Reason :: running | restarting | not_found. delete(Module, Name) -> supervisor:delete_child(?MODULE, {Module, Name}). diff --git a/src/sregulator.erl b/src/sregulator.erl index 390a645..b48edf1 100644 --- a/src/sregulator.erl +++ b/src/sregulator.erl @@ -145,6 +145,7 @@ -type handler_spec() :: {module(), any()}. -export_type([regulator/0]). +-export_type([name/0]). -export_type([handler_spec/0]). -callback init(Args :: any()) -> diff --git a/src/sregulator_codel_valve.erl b/src/sregulator_codel_valve.erl index 22ab639..591da9c 100644 --- a/src/sregulator_codel_valve.erl +++ b/src/sregulator_codel_valve.erl @@ -20,11 +20,7 @@ %% @doc Implements a valve which increases its size based on CoDel (Controlling %% Queue Delay). %% -%% decreasing -%% intervals of updates being below a target between a minimum and maximum -%% capacity. -%% -%% `sregulator_codel_value' can be used as the `sregulator_valve' in a +%% `sregulator_codel_valve' can be used as the `sregulator_valve' in a %% `sregulator'. It will provide a valve that increases in size in decreasing %% intervals while updates remain below a target (based on CoDel) between the %% minimum and maximum capacity. Its argument, `spec()', is of the form: diff --git a/src/sregulator_rate_valve.erl b/src/sregulator_rate_valve.erl index 5d8c7ab..f35db28 100644 --- a/src/sregulator_rate_valve.erl +++ b/src/sregulator_rate_valve.erl @@ -25,10 +25,10 @@ %% between a minimum and maximum capacity. Its argument, `spec()', is of the %% form: %% ``` -%% #{limit => non_neg_integer(), % default: 100 -%% interval => pos_integer(), % default: 1000 -%% min => non_neg_integer(), % default: 0 -%% max => non_neg_integer() | infinity}. % default: infinity +%% #{limit => Limit :: non_neg_integer(), % default: 100 +%% interval => Interval :: pos_integer(), % default: 1000 +%% min => Min :: non_neg_integer(), % default: 0 +%% max => Max :: non_neg_integer() | infinity}. % default: infinity %% ''' %% `Limit' is the number of new tasks (defaults to `100') that can run when the %% number of concurrent tasks is at or above the minimum capacity, `Min' diff --git a/src/sregulator_update_meter.erl b/src/sregulator_update_meter.erl index 2a9e8c1..dfefdc4 100644 --- a/src/sregulator_update_meter.erl +++ b/src/sregulator_update_meter.erl @@ -68,7 +68,7 @@ -spec init(Time, Spec | {Spec, Seed}) -> {State, UpdateNext} when Time :: integer(), Spec :: spec(), - Seed :: rand:seed(), + Seed :: rand:export_state(), State :: #state{}, UpdateNext :: integer(). init(Time, {[Regulator], Seed}) -> @@ -133,7 +133,7 @@ code_change(_, Time, State, _) -> {NState, UpdateNext} when Time :: integer(), Spec :: spec(), - Seed :: rand:seed(), + Seed :: rand:export_state(), State :: #state{}, NState :: #state{}, UpdateNext :: integer(). diff --git a/src/sregulator_user.erl b/src/sregulator_user.erl index 82612c7..84f6ff6 100644 --- a/src/sregulator_user.erl +++ b/src/sregulator_user.erl @@ -71,7 +71,7 @@ %% in `regulators' or `{error, Reason}' if the regulator fails to start with %% reason `Reason'. -spec start(Name) -> {ok, Pid} | {error, Reason} when - Name :: sregulator:regulator(), + Name :: sregulator:name(), Pid :: pid() | undefined, Reason :: term(). start(Name) -> @@ -89,7 +89,7 @@ start(Name) -> %% in `regulators' or `{error, Reason}' if the regulator fails to start with %% reason `Reason'. -spec restart(Name) -> {ok, Pid} | {error, Reason} when - Name :: sregulator:regulator(), + Name :: sregulator:name(), Pid :: pid() | undefined, Reason :: term(). restart(Name) -> @@ -106,7 +106,7 @@ restart(Name) -> %% Returns `ok' once the regulator is terminated, otherwise %% `{error, not_found}'. -spec terminate(Name) -> ok | {error, not_found} when - Name :: sregulator:regulator(). + Name :: sregulator:name(). terminate(Name) -> sbroker_user_sup:terminate(?MODULE, Name). @@ -121,7 +121,7 @@ terminate(Name) -> %% Returns `ok' on successfully deleting the regulator, otherwise %% `{error, Reason}' where `Reason' is reason for the error. -spec delete(Name) -> ok | {error, Reason} when - Name :: sregulator:regulator(), + Name :: sregulator:name(), Reason :: running | restarting | not_found. delete(Name) -> sbroker_user_sup:delete(?MODULE, Name).
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor