store

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAppNotFound  = errors.New("Update app failed: target app was not found")
	ErrTaskNotFound = errors.New("Update task failed: target task was not found")
)

Functions

This section is empty.

Types

type FrameworkStore

type FrameworkStore struct {
	BoltbDb  *bolt.DB
	RaftNode *raft.Node
}

func NewStore

func NewStore(db *bolt.DB, raftNode *raft.Node) *FrameworkStore

func (*FrameworkStore) CommitAppProposeVersion

func (s *FrameworkStore) CommitAppProposeVersion(ctx context.Context, app *types.Application, cb func()) error

func (*FrameworkStore) CreateApp

func (s *FrameworkStore) CreateApp(ctx context.Context, app *types.Application, cb func()) error

func (*FrameworkStore) CreateOfferAllocatorItem

func (s *FrameworkStore) CreateOfferAllocatorItem(ctx context.Context, item *types.OfferAllocatorItem, cb func()) error

func (*FrameworkStore) CreateSlot

func (s *FrameworkStore) CreateSlot(ctx context.Context, slot *types.Slot, cb func()) error

func (*FrameworkStore) DeleteApp

func (s *FrameworkStore) DeleteApp(ctx context.Context, appId string, cb func()) error

func (*FrameworkStore) DeleteOfferAllocatorItem

func (s *FrameworkStore) DeleteOfferAllocatorItem(ctx context.Context, slotID string, cb func()) error

func (*FrameworkStore) DeleteSlot

func (s *FrameworkStore) DeleteSlot(ctx context.Context, appID, slotID string, cb func()) error

func (*FrameworkStore) GetApp

func (s *FrameworkStore) GetApp(appId string) (*types.Application, error)

func (*FrameworkStore) GetFrameworkId

func (s *FrameworkStore) GetFrameworkId() (string, error)

func (*FrameworkStore) GetSlot

func (s *FrameworkStore) GetSlot(appId, slotId string) (*types.Slot, error)

func (*FrameworkStore) GetVersion

func (s *FrameworkStore) GetVersion(appId, versionId string) (*types.Version, error)

func (*FrameworkStore) ListApps

func (s *FrameworkStore) ListApps() ([]*types.Application, error)

func (*FrameworkStore) ListOfferallocatorItems

func (s *FrameworkStore) ListOfferallocatorItems() ([]*types.OfferAllocatorItem, error)

func (*FrameworkStore) ListSlots

func (s *FrameworkStore) ListSlots(appId string) ([]*types.Slot, error)

func (*FrameworkStore) ListTasks

func (s *FrameworkStore) ListTasks(appId, slotId string) ([]*types.Task, error)

func (*FrameworkStore) ListVersions

func (s *FrameworkStore) ListVersions(appId string) ([]*types.Version, error)

retuns app history versions

func (*FrameworkStore) UpdateApp

func (s *FrameworkStore) UpdateApp(ctx context.Context, app *types.Application, cb func()) error

func (*FrameworkStore) UpdateFrameworkId

func (s *FrameworkStore) UpdateFrameworkId(ctx context.Context, frameworkId string, cb func()) error

func (*FrameworkStore) UpdateSlot

func (s *FrameworkStore) UpdateSlot(ctx context.Context, slot *types.Slot, cb func()) error

func (*FrameworkStore) UpdateTask

func (s *FrameworkStore) UpdateTask(ctx context.Context, task *types.Task, cb func()) error

as same as update version we need do this follow steps in one transaction 1. find this old slot info from data. 2. push this old slot's current task to task history. 3. set the new task as the slot's current task. 4. store the new slot info. 5. put all actions in one storeActions tp propose data.

func (*FrameworkStore) UpdateVersion

func (s *FrameworkStore) UpdateVersion(ctx context.Context, appId string, version *types.Version, cb func()) error

To update an application version we need the follow steps in one transaction 1. find the old app info from database. 2. set new version's pervious versionId to the old version's id 3. push thie old version to version history 4. store the new version in app data 5. put all actions in one storeActions to propose data.

type Store

type Store interface {
	CreateApp(ctx context.Context, app *types.Application, cb func()) error
	UpdateApp(ctx context.Context, app *types.Application, cb func()) error
	CommitAppProposeVersion(ctx context.Context, app *types.Application, cb func()) error
	GetApp(appId string) (*types.Application, error)
	ListApps() ([]*types.Application, error)
	DeleteApp(ctx context.Context, appId string, cb func()) error
	UpdateVersion(ctx context.Context, appId string, version *types.Version, cb func()) error
	GetVersion(appId, versionId string) (*types.Version, error)
	ListVersions(appId string) ([]*types.Version, error)
	CreateSlot(ctx context.Context, slot *types.Slot, cb func()) error
	GetSlot(appId, slotId string) (*types.Slot, error)
	ListSlots(appId string) ([]*types.Slot, error)
	UpdateSlot(ctx context.Context, slot *types.Slot, cb func()) error
	DeleteSlot(ctx context.Context, appId, slotId string, cb func()) error
	UpdateTask(ctx context.Context, task *types.Task, cb func()) error
	ListTasks(appId, slotId string) ([]*types.Task, error)
	UpdateFrameworkId(ctx context.Context, frameworkId string, cb func()) error
	GetFrameworkId() (string, error)

	CreateOfferAllocatorItem(context.Context, *types.OfferAllocatorItem, func()) error
	DeleteOfferAllocatorItem(context.Context, string, func()) error
	ListOfferallocatorItems() ([]*types.OfferAllocatorItem, error)
}

Jump to

Keyboard shortcuts

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