github.com/timstclair/heapster@v0.20.0-alpha1/Godeps/_workspace/src/k8s.io/kubernetes/pkg/util/bandwidth/interfaces.go (about)

     1  /*
     2  Copyright 2015 The Kubernetes Authors All rights reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package bandwidth
    18  
    19  import "k8s.io/kubernetes/pkg/api/resource"
    20  
    21  type BandwidthShaper interface {
    22  	// Limit the bandwidth for a particular CIDR on a particular interface
    23  	//   * ingress and egress are in bits/second
    24  	//   * cidr is expected to be a valid network CIDR (e.g. '1.2.3.4/32' or '10.20.0.1/16')
    25  	// 'egress' bandwidth limit applies to all packets on the interface whose source matches 'cidr'
    26  	// 'ingress' bandwidth limit applies to all packets on the interface whose destination matches 'cidr'
    27  	// Limits are aggregate limits for the CIDR, not per IP address.  CIDRs must be unique, but can be overlapping, traffic
    28  	// that matches multiple CIDRs counts against all limits.
    29  	Limit(cidr string, egress, ingress *resource.Quantity) error
    30  	// Remove a bandwidth limit for a particular CIDR on a particular network interface
    31  	Reset(cidr string) error
    32  	// Reconcile the interface managed by this shaper with the state on the ground.
    33  	ReconcileInterface() error
    34  	// Reconcile a CIDR managed by this shaper with the state on the ground
    35  	ReconcileCIDR(cidr string, egress, ingress *resource.Quantity) error
    36  	// GetCIDRs returns the set of CIDRs that are being managed by this shaper
    37  	GetCIDRs() ([]string, error)
    38  }