controldbserver

package
v0.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartControlDBServer

func StartControlDBServer(cluster string, dataDir string, tlsEnabled bool, certFile, keyFile string)

StartControlDBServer initializes and starts the controldb server

Types

type ControlDBServer

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

ControlDBServer implements DBService server.

The server design needs to be scalable, to support like 100 services in one cluster, and 10,000 serviceMembers per service. Every cluster will run its own control db service. If one service needs to cross clusters, such as 2 aws regions, federation (could simply be the service init script) will coordinate it. For example, federation creates the services on each cluster with two-phases. Firstly create service with the initial status. After the services are created in all clusters, change status to active.

Design options, go with #2. 1. use kv DB such as levelDB or RocksDB. looks over complex? If something goes wrong, not easy to debug. For example, some bug causes data corrupted, or file system crashes. 2. simply use file and directory. cluster/service data could be separated, will not impact each other. could control how data is organized, such as version support, atomic write via rename, etc. Could have the simple common solution for scalability. Limits the max children of one directory. If have more children, create a new directory. The example directory hierarchy:

  /rootDir/cluster0/device.v0
 				  cluster0/device.v1
					  cluster0/service.v0
					  cluster0/service.v1
           cluster0/servicedir/service0-uuid/attr.v0
                       	      service0-uuid/attr.v1
     												  service0-uuid/serviceMemberdir/member0
     												  service0-uuid/serviceMemberdir/...
     												  service0-uuid/serviceMemberdir/member1000
     												  service0-uuid/configdir/configfile0
     												  service0-uuid/configdir/...
     												  service0-uuid/configdir/configfile1000
     												  ...
						 				  			    service1000-uuid/
           cluster0/serviceipdir/ipfile0
           cluster0/serviceipdir/...
           cluster0/serviceipdir/ipfile1000

For device, one device has very small data. Could simply write all devices' assignments into a single file. Keep like the last 10 versions would be enough. Similar for service, all services will be kept in a single file.

func NewControlDBServer

func NewControlDBServer(rootPath string, clusterName string) (*ControlDBServer, error)

func (*ControlDBServer) CreateConfigFile

func (s *ControlDBServer) CreateConfigFile(ctx context.Context, cfg *pb.ConfigFile) (*pb.CreateConfigFileResponse, error)

func (*ControlDBServer) CreateDevice

func (s *ControlDBServer) CreateDevice(ctx context.Context, dev *pb.Device) (*pb.CreateDeviceResponse, error)

func (*ControlDBServer) CreateService

func (s *ControlDBServer) CreateService(ctx context.Context, svc *pb.Service) (*pb.CreateServiceResponse, error)

func (*ControlDBServer) CreateServiceAttr

func (s *ControlDBServer) CreateServiceAttr(ctx context.Context, attr *pb.ServiceAttr) (*pb.CreateServiceAttrResponse, error)

func (*ControlDBServer) CreateServiceMember

func (s *ControlDBServer) CreateServiceMember(ctx context.Context, member *pb.ServiceMember) (*pb.CreateServiceMemberResponse, error)

func (*ControlDBServer) CreateServiceStaticIP added in v0.8.1

func (s *ControlDBServer) CreateServiceStaticIP(ctx context.Context, serviceip *pb.ServiceStaticIP) (*pb.CreateServiceStaticIPResponse, error)

func (*ControlDBServer) DeleteConfigFile

func (s *ControlDBServer) DeleteConfigFile(ctx context.Context, key *pb.ConfigFileKey) (*pb.DeleteConfigFileResponse, error)

func (*ControlDBServer) DeleteDevice

func (s *ControlDBServer) DeleteDevice(ctx context.Context, key *pb.DeviceKey) (*pb.DeleteDeviceResponse, error)

func (*ControlDBServer) DeleteService

func (s *ControlDBServer) DeleteService(ctx context.Context, key *pb.ServiceKey) (*pb.DeleteServiceResponse, error)

func (*ControlDBServer) DeleteServiceAttr

func (s *ControlDBServer) DeleteServiceAttr(ctx context.Context, key *pb.ServiceAttrKey) (*pb.DeleteServiceAttrResponse, error)

func (*ControlDBServer) DeleteServiceMember

func (s *ControlDBServer) DeleteServiceMember(ctx context.Context, key *pb.ServiceMemberKey) (*pb.DeleteServiceMemberResponse, error)

func (*ControlDBServer) DeleteServiceStaticIP added in v0.8.1

func (*ControlDBServer) GetConfigFile

func (s *ControlDBServer) GetConfigFile(ctx context.Context, key *pb.ConfigFileKey) (*pb.ConfigFile, error)

func (*ControlDBServer) GetDevice

func (s *ControlDBServer) GetDevice(ctx context.Context, key *pb.DeviceKey) (*pb.Device, error)

func (*ControlDBServer) GetService

func (s *ControlDBServer) GetService(ctx context.Context, key *pb.ServiceKey) (*pb.Service, error)

func (*ControlDBServer) GetServiceAttr

func (s *ControlDBServer) GetServiceAttr(ctx context.Context, key *pb.ServiceAttrKey) (*pb.ServiceAttr, error)

func (*ControlDBServer) GetServiceMember

func (s *ControlDBServer) GetServiceMember(ctx context.Context, key *pb.ServiceMemberKey) (*pb.ServiceMember, error)

func (*ControlDBServer) GetServiceStaticIP added in v0.8.1

func (s *ControlDBServer) GetServiceStaticIP(ctx context.Context, key *pb.ServiceStaticIPKey) (*pb.ServiceStaticIP, error)

func (*ControlDBServer) ListDevices

func (*ControlDBServer) ListServiceMembers

func (*ControlDBServer) ListServices

func (*ControlDBServer) Stop

func (s *ControlDBServer) Stop()

func (*ControlDBServer) UpdateServiceAttr

func (*ControlDBServer) UpdateServiceMember

func (*ControlDBServer) UpdateServiceStaticIP added in v0.8.1

Jump to

Keyboard shortcuts

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