Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ftr: add comment for cluster #584

Merged
merged 4 commits into from
Jun 4, 2020

Conversation

watermelo
Copy link
Member

What this PR does:
add comment for cluster directory

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@watermelo
Copy link
Member Author

#564

@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2020

Codecov Report

Merging #584 into develop will increase coverage by 0.37%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #584      +/-   ##
===========================================
+ Coverage    66.43%   66.81%   +0.37%     
===========================================
  Files          184      184              
  Lines         9712     9690      -22     
===========================================
+ Hits          6452     6474      +22     
+ Misses        2620     2576      -44     
  Partials       640      640              
Impacted Files Coverage Δ
cluster/cluster_impl/available_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/available_cluster_invoker.go 73.33% <ø> (ø)
cluster/cluster_impl/broadcast_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/failback_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/failfast_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/failover_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/failsafe_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/forking_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/mock_cluster.go 0.00% <ø> (ø)
cluster/cluster_impl/registry_aware_cluster.go 100.00% <ø> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4af26b9...0a06522. Read the comment docs.

cluster/cluster.go Outdated Show resolved Hide resolved
cluster/loadbalance/least_active.go Show resolved Hide resolved
@watermelo watermelo changed the title Feat: add comment for cluster Ftr: add comment for cluster Jun 3, 2020
@@ -35,7 +35,7 @@ type availableClusterInvoker struct {
baseClusterInvoker
}

// NewAvailableClusterInvoker ...
// NewAvailableClusterInvoker returns cluster invoker instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewAvailableClusterInvoker returns a cluster invoker instance

// NewBroadcastCluster ...
// NewBroadcastCluster returns broadcast cluster instance
//
// Calling all providers broadcast, one by one call, any error is reported.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewBroadcastCluster returns a broadcast cluster instance.
//
// Calling all providers' broadcast one by one. All errors will be reported.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the meaning of providers' ?

@@ -31,7 +31,10 @@ func init() {
extension.SetCluster(failback, NewFailbackCluster)
}

// NewFailbackCluster ...
// NewFailbackCluster returns failback cluster instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewFailbackCluster returns a failback cluster instance.

@@ -52,7 +52,9 @@ func init() {

type roundRobinLoadBalance struct{}

// NewRoundRobinLoadBalance ...
// NewRoundRobinLoadBalance returns round robin load balance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewFailFastCluster returns a failfast cluster instance

// NewRandomLoadBalance ...
// NewRandomLoadBalance returns random load balance instance
//
// Set random probabilities by weight, the request sent to provider is random
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewRandomLoadBalance returns a random load balance instance.
//
// Set random probabilities by weight, and the request will be sent to provider randomly.

//
// Mock cluster is usually used for service degradation, such as an authentication service.
// When the service provider is completely hung up, the client does not throw an exception,
// but returns the authorization failure through the Mock data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewMockCluster returns a mock cluster instance.
//
// Mock cluster is usually used for service degradation, such as an authentication service.
// When the service provider is completely hung up, the client does not throw an exception,
// return an authorization failure through the Mock data instead.

// NewForkingCluster returns forking cluster instance
//
// Multiple servers are invoked in parallel, returning as soon as one succeeds.
// Usually used for real-time demanding read operations, but need to waste more service resources.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewForkingCluster returns a forking cluster instance.
//
// Multiple servers will be invoked in parallel at the same time, and return asap when
// getting response from the fastest server.
// Usually it is used for real-time demanding read operations while wasting more service resources.

// NewFailsafeCluster ...
// NewFailsafeCluster returns failsafe cluster instance
//
// Failure of security, anomalies, directly ignored. Usually used to write audit logs and other operations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewFailsafeCluster returns an failsafe cluster instance.
//
// Failure of security, anomalies, directly ignored. Usually it is
// used to write audit logs and other operations.

//
// Failure automatically switch, when there is failure,
// retry the other server (default). Usually used for read operations,
// but retries can result in longer delays.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewFailoverCluster returns a failover cluster instance.
//
// Failure automatically switch, when there is a failure,
// retry the other server (default). Usually used for read operations,
// but retries can result in longer delays.

// NewFailFastCluster returns failfast cluster instance
//
// Fast failure, only made a call, failure immediately error. Usually used for non-idempotent write operations,
// such as adding records.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// NewFailFastCluster returns a failfast cluster instance.
//
// Fast failure, only made a call, failure immediately error. Usually used for non-idempotent write operations,
// such as adding records.

@zouyx zouyx linked an issue Jun 3, 2020 that may be closed by this pull request
@zouyx zouyx merged commit a7af538 into apache:develop Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhance] Add comments for cluster directory
5 participants