Documentation ¶
Overview ¶
Copyright (c) 2016-2019 Uber Technologies, Inc.
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.
Copyright (c) 2016-2019 Uber Technologies, Inc.
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.
Copyright (c) 2016-2019 Uber Technologies, Inc.
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.
Copyright (c) 2016-2019 Uber Technologies, Inc.
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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // MaxReplica is the max number of hosts each blob will be replicated across. // If MaxReplica is >= the number of hosts in the ring, every host will own // every blob. MaxReplica int `yaml:"max_replica"` // RefreshInterval is the interval at which membership / health information // is refreshed during monitoring. RefreshInterval time.Duration `yaml:"refresh_interval"` }
Config defines Ring configuration.
type Option ¶
type Option func(*ring)
Option allows setting custom parameters for ring.
func WithWatcher ¶
WithWatcher adds a watcher to the ring. Can be used multiple times.
type PassiveRing ¶
PassiveRing is a wrapper around Ring which supports passive health checks. See healthcheck.PassiveFilter for passive health check documentation.
func NewPassive ¶
func NewPassive( config Config, cluster hostlist.List, passiveFilter healthcheck.PassiveFilter, opts ...Option) PassiveRing
NewPassive creats a new PassiveRing.
func NoopPassiveRing ¶
func NoopPassiveRing(hosts hostlist.List) PassiveRing
NoopPassiveRing returns a PassiveRing which never filters unhealthy hosts.
type Ring ¶
type Ring interface { Locations(d core.Digest) []string Contains(addr string) bool Monitor(stop <-chan struct{}) Refresh() }
Ring is a rendezvous hashing ring which calculates an ordered replica set of healthy addresses which own any given digest.
Address membership within the ring is defined by a dynamic hostlist.List. On top of that, replica sets are filtered by the health status of their addresses. Membership and health status may be refreshed by using Monitor.
Ring maintains the invariant that it is always non-empty and can always provide locations, although in some scenarios the provided locations are not guaranteed to be healthy (see Locations).