stream

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Copyright 2017 Mirantis

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

func CopyDetachable

func CopyDetachable(dst io.Writer, src io.Reader, keys []byte) (written int64, err error)

based on https://github.com/kubernetes-incubator/cri-o/blob/master/utils/utils.go#L90 CopyDetachable is similar to io.Copy but support a detach key sequence to break out.

func NewLogWriter

func NewLogWriter(stdout <-chan []byte, logFile string, wg *sync.WaitGroup)

NewLogWritter writes the lines from stdout channel in logFile in k8s format

Types

type DetachError

type DetachError struct{}

DetachError is special error which returned in case of container detach.

func (DetachError) Error

func (DetachError) Error() string

type Server

type Server struct {
	DeadlineSeconds int

	streaming.Runtime
	// contains filtered or unexported fields
}

Server implements streaming.Runtime

func NewServer

func NewServer(kubernetesDir, socketPath string, metadataStore metadata.MetadataStore) (*Server, error)

NewServer creates a new Server

func (*Server) Attach

func (s *Server) Attach(containerID string, inputStream io.Reader, outputStream, errorStream io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error

Attach endpoint for streaming.Runtime

func (*Server) GetAttach

func (s *Server) GetAttach(req *kubeapi.AttachRequest) (*kubeapi.AttachResponse, error)

GetAttach returns attach stream request

func (*Server) GetPortForward

func (s *Server) GetPortForward(req *kubeapi.PortForwardRequest) (*kubeapi.PortForwardResponse, error)

GetPortForward returns pofrforward stream request

func (*Server) PortForward

func (s *Server) PortForward(podSandboxID string, port int32, stream io.ReadWriteCloser) error

PortForward endpoint for streaming.Runtime

func (*Server) Start

func (s *Server) Start() error

Start starts streaming server gorutine and unixServer gorutine

func (*Server) Stop

func (s *Server) Stop()

Stop stops all goroutines

type UnixServer

type UnixServer struct {
	SocketPath string

	UnixConnections *syncmap.Map
	// contains filtered or unexported fields
}

UnixServer listens for connections from qemu instances and sends its stdout to registerd channels.

func NewUnixServer

func NewUnixServer(socketPath, kubernetesDir string) *UnixServer

NewUnixServer creates new UnixServer. Requires socketPath on which it will listen and kubernetesDir where logs will be written

func (*UnixServer) AddOutputReader

func (u *UnixServer) AddOutputReader(containerID string, newChan chan []byte)

AddOutputReader adds a new channel for containerID to send stdout

func (*UnixServer) Listen

func (u *UnixServer) Listen()

Listen starts listening for connections from qemus

func (*UnixServer) RemoveOutputReader

func (u *UnixServer) RemoveOutputReader(containerID string, readerChan chan []byte)

RemoveOutputReader removes a channel for containerID

func (*UnixServer) Stop

func (u *UnixServer) Stop()

Stop stops listening and waits for all writers to finish

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL