dao

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// enumerate queue type.
	QueueTypeDapr           QueueType = "dapr"
	QueueTypeKafkaTopic     QueueType = "kafka.topic"
	QueueTypeKafkaPartition QueueType = "kafka.topic.partition"

	// enumerate consumer type.
	ConsumerTypeCore     ConsumerType = "core"
	ConsumerTypeDispatch ConsumerType = "dispatcher"
)
View Source
const EntityStorePrefix = "core.entity."
View Source
const (
	// store mapper prefix key.
	MapperPrefix = "CORE.MAPPER"
)
View Source
const (
	// store queue prefix key.
	QueuePrefix = "CORE.QUEUE"
)

Variables

This section is empty.

Functions

func GetEntityCodec

func GetEntityCodec() entityCodec

Types

type ConsumerType

type ConsumerType string

func (ConsumerType) String

func (ct ConsumerType) String() string

type Dao

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

func New

func New(ctx context.Context, storeCfg config.Metadata, etcdCfg config.EtcdConfig) (*Dao, error)

func (*Dao) DelEntity

func (d *Dao) DelEntity(ctx context.Context, id string) error

func (*Dao) DelMapper

func (d *Dao) DelMapper(ctx context.Context, m *Mapper) error

func (*Dao) DelQueue

func (d *Dao) DelQueue(ctx context.Context, q *Queue) error

func (*Dao) GetEntity

func (d *Dao) GetEntity(ctx context.Context, id string) (en *Entity, err error)

func (*Dao) GetLastRevision

func (d *Dao) GetLastRevision(ctx context.Context) int64

func (*Dao) GetMapper

func (d *Dao) GetMapper(ctx context.Context, m *Mapper) (*Mapper, error)

func (*Dao) GetQueue

func (d *Dao) GetQueue(ctx context.Context, q *Queue) (*Queue, error)

func (*Dao) HasEntity

func (d *Dao) HasEntity(ctx context.Context, id string) (bool, error)

func (*Dao) HasMapper

func (d *Dao) HasMapper(ctx context.Context, m *Mapper) (bool, error)

func (*Dao) HasQueue

func (d *Dao) HasQueue(ctx context.Context, q *Queue) (bool, error)

func (*Dao) ListMapper

func (d *Dao) ListMapper(ctx context.Context, rev int64, req *ListMapperReq) ([]Mapper, error)

func (*Dao) PutEntity

func (d *Dao) PutEntity(ctx context.Context, en *Entity) error

dao interfaces.

func (*Dao) PutMapper

func (d *Dao) PutMapper(ctx context.Context, m *Mapper) error

func (*Dao) PutQueue

func (d *Dao) PutQueue(ctx context.Context, q *Queue) error

func (*Dao) RangeMapper

func (d *Dao) RangeMapper(ctx context.Context, rev int64, handler MapperHandler)

func (*Dao) RangeQueue

func (d *Dao) RangeQueue(ctx context.Context, rev int64, handler QueueHandler)

func (*Dao) WatchMapper

func (d *Dao) WatchMapper(ctx context.Context, rev int64, handler WatchMapperHandler)

func (*Dao) WatchQueue

func (d *Dao) WatchQueue(ctx context.Context, rev int64, handler WatchQueueHandler)

type Entity

type Entity struct {
	ID            string               `json:"id" msgpack:"id" mapstructure:"id"`
	Type          string               `json:"type" msgpack:"type" mapstructure:"type"`
	Owner         string               `json:"owner" msgpack:"owner" mapstructure:"owner"`
	Source        string               `json:"source" msgpack:"source" mapstructure:"source"`
	Version       int64                `json:"version" msgpack:"version" mapstructure:"version"`
	LastTime      int64                `json:"last_time" msgpack:"last_time" mapstructure:"last_time"`
	TemplateID    string               `json:"template_id" msgpack:"template_id" mapstructure:"template_id"`
	Properties    map[string]tdtl.Node `json:"-" msgpack:"-" mapstructure:"-"`
	ConfigBytes   []byte               `json:"-" msgpack:"config_bytes" mapstructure:"config_bytes"`
	PropertyBytes []byte               `json:"property_bytes" msgpack:"property_bytes" mapstructure:"property_bytes"`
}

func (*Entity) Basic

func (e *Entity) Basic() Entity

func (*Entity) Copy

func (e *Entity) Copy() Entity

func (*Entity) JSON

func (e *Entity) JSON() string

type EnventType

type EnventType mvccpb.Event_EventType

func (EnventType) String

func (et EnventType) String() string

type IDao

type IDao interface {
	Get(ctx context.Context, id string) (en *Entity, err error)
	Put(ctx context.Context, en *Entity) error
	Exists(ctx context.Context, id string) error
}

type ListMapperReq

type ListMapperReq struct {
	Owner    string
	EntityID string
}

type Mapper

type Mapper struct {
	ID          string
	TQL         string
	Name        string
	Owner       string
	EntityID    string
	Description string
}

func (*Mapper) Copy

func (m *Mapper) Copy() Mapper

func (*Mapper) Key

func (m *Mapper) Key() string

type MapperHandler

type MapperHandler func([]Mapper)

type Queue

type Queue struct {
	ID           string
	Name         string
	Type         QueueType
	Version      int64
	NodeName     string   // NodeName for core.
	Consumers    []string // Consumers for dispatcher.
	ConsumerType ConsumerType
	Description  string
	Metadata     map[string]interface{}
}

func (*Queue) Check

func (q *Queue) Check() error

func (*Queue) Key

func (q *Queue) Key() string

type QueueHandler

type QueueHandler func([]Queue)

type QueueType

type QueueType string

func (QueueType) String

func (qt QueueType) String() string

type WatchMapperHandler

type WatchMapperHandler func(EnventType, Mapper)

type WatchQueueHandler

type WatchQueueHandler func(EnventType, Queue)

Jump to

Keyboard shortcuts

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