stack

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenConnection

func OpenConnection(hostname string, port int) (*grpc.ClientConn, error)

OpenConnection opens a connection to a stack server. Don't forget to close the connection.

func Serve

func Serve(port int)

Serve starts the GRPC server

Types

type Server

type Server struct {
	pb.StackServiceServer
}

Server is the GRPC server

func (*Server) Pop

Pop pops a number from the stack

func (*Server) Push

Push pushes a number to the stack

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack() *Stack

NewStack creates a new instance of the Stack struct.

func (*Stack) Pop

func (s *Stack) Pop() (int32, bool)

Pop removes and returns the top element from the stack.

func (*Stack) Push

func (s *Stack) Push(value int32)

Push adds a new value to the stack.

func (*Stack) Size

func (s *Stack) Size() int32

Size returns the size of the Stack.

Jump to

Keyboard shortcuts

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