Пример #1
0
// NewEnv stores a new env.
func NewEnv(as *aerospike.Client, env string, description string) error {
	key, err := envKey(env)
	if err != nil {
		return err
	}
	wp := aerospike.NewWritePolicy(0, 0)
	wp.RecordExistsAction = aerospike.CREATE_ONLY
	return as.PutObject(wp, key, &EnvData{Description: description})
}
Пример #2
0
// NewService stores a new service.
func NewService(
	as *aerospike.Client, env string, service string,
	description string, isPublic bool) error {
	key, err := serviceKey(env, service)
	if err != nil {
		return err
	}
	wp := aerospike.NewWritePolicy(0, 0)
	wp.RecordExistsAction = aerospike.CREATE_ONLY
	return as.PutObject(wp, key, &ServiceData{
		Env: env,
		// TODO: This is not guaranteed to be unique. Should figure out a way
		//       to generate this uniquely.
		UniqueID:        leverutil.RandomHostName(),
		Description:     description,
		NextCodeVersion: 0,
		LiveCodeVersion: 0,
		IsPublic:        isPublic,
	})
}