Ejemplo n.º 1
0
func NewLogeDB(store LogeStore) *LogeDB {
	return &LogeDB{
		types:          make(typeMap),
		store:          store,
		cache:          make(objCache),
		lastSnapshotID: 1,
		linkTypeSpec:   spack.MakeTypeSpec([]string{}),
	}
}
Ejemplo n.º 2
0
	Exemplar interface{}
	Links    LinkSpec
	Upgrader spack.UpgradeFunc
}

func NewTypeDef(name string, version uint16, exemplar interface{}) *TypeDef {
	return &TypeDef{
		Name:     name,
		Version:  version,
		Exemplar: exemplar,
	}
}

// -----------------------

var linkSpec *spack.TypeSpec = spack.MakeTypeSpec([]string{})
var linkInfoSpec *spack.TypeSpec = spack.MakeTypeSpec(linkInfo{})

type logeType struct {
	Name      string
	Version   uint16
	Exemplar  interface{}
	SpackType *spack.VersionedType
	Links     map[string]*linkInfo
}

func newType(name string, version uint16, exemplar interface{}, linkSpec LinkSpec, spackType *spack.VersionedType) *logeType {
	var infos = make(map[string]*linkInfo)
	for k, v := range linkSpec {
		infos[k] = &linkInfo{
			Name:   k,