Documentation
¶
Overview ¶
* Copyright 2020 The Knative Authors * * 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
- func ConfigureConnectionArgs(ca *ConnectionArgs)
- func CreateHandler(handler nethttp.Handler) nethttp.Handler
- func WithShutdownTimeout(ctx context.Context, timeout time.Duration) context.Context
- func WriteHttpRequestWithAdditionalHeaders(ctx context.Context, message binding.Message, req *nethttp.Request, ...) error
- type Backoff
- type CheckRetry
- type ConnectionArgs
- type HttpMessageReceiver
- type HttpMessageSender
- func (s *HttpMessageSender) NewCloudEventRequest(ctx context.Context) (*nethttp.Request, error)
- func (s *HttpMessageSender) NewCloudEventRequestWithTarget(ctx context.Context, target string) (*nethttp.Request, error)
- func (s *HttpMessageSender) Send(req *nethttp.Request) (*nethttp.Response, error)
- func (s *HttpMessageSender) SendWithRetries(req *nethttp.Request, config *RetryConfig) (*nethttp.Response, error)
- type RetryConfig
Constants ¶
const (
DefaultShutdownTimeout = time.Minute * 1
)
Variables ¶
This section is empty.
Functions ¶
func ConfigureConnectionArgs ¶ added in v0.17.9
func ConfigureConnectionArgs(ca *ConnectionArgs)
ConfigureConnectionArgs configures the new connection args. The existing client won't be affected, but a new one will be created. Use sparingly, because it might lead to creating a lot of clients, none of them sharing their connection pool!
func WithShutdownTimeout ¶ added in v0.14.0
Types ¶
type Backoff ¶ added in v0.17.0
Backoff specifies a policy for how long to wait between retries. It is called after a failing request to determine the amount of time that should pass before trying again.
type CheckRetry ¶ added in v0.17.0
CheckRetry specifies a policy for handling retries. It is called following each request with the response and error values returned by the http.Client. If CheckRetry returns false, the Client stops retrying and returns the response to the caller. If CheckRetry returns an error, that error value is returned in lieu of the error from the request. The Client will close any response body when retrying, but if the retry is aborted it is up to the CheckRetry callback to properly close any response body before returning.
type ConnectionArgs ¶ added in v0.10.0
type ConnectionArgs struct { // MaxIdleConns refers to the max idle connections, as in net/http/transport. MaxIdleConns int // MaxIdleConnsPerHost refers to the max idle connections per host, as in net/http/transport. MaxIdleConnsPerHost int }
ConnectionArgs allow to configure connection parameters to the underlying HTTP Client transport.
type HttpMessageReceiver ¶ added in v0.14.0
type HttpMessageReceiver struct {
// contains filtered or unexported fields
}
func NewHttpMessageReceiver ¶ added in v0.14.0
func NewHttpMessageReceiver(port int) *HttpMessageReceiver
func (*HttpMessageReceiver) StartListen ¶ added in v0.14.0
Blocking
type HttpMessageSender ¶ added in v0.14.0
func NewHttpMessageSender
deprecated
added in
v0.14.0
func NewHttpMessageSender(ca *ConnectionArgs, target string) (*HttpMessageSender, error)
Deprecated: Don't use this anymore, now it has the same effect of NewHTTPMessageSenderWithTarget If you need to modify the connection args, use ConfigureConnectionArgs sparingly.
func (*HttpMessageSender) NewCloudEventRequest ¶ added in v0.14.0
func (*HttpMessageSender) NewCloudEventRequestWithTarget ¶ added in v0.14.0
func (*HttpMessageSender) SendWithRetries ¶ added in v0.17.0
func (s *HttpMessageSender) SendWithRetries(req *nethttp.Request, config *RetryConfig) (*nethttp.Response, error)
type RetryConfig ¶ added in v0.17.0
type RetryConfig struct { // Maximum number of retries RetryMax int CheckRetry CheckRetry Backoff Backoff }
func NoRetries ¶ added in v0.17.0
func NoRetries() RetryConfig
func RetryConfigFromDeliverySpec ¶ added in v0.17.0
func RetryConfigFromDeliverySpec(spec duckv1.DeliverySpec) (RetryConfig, error)