MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / createSQLChain

Method createSQLChain

blockproducer/metastate.go:383–406  ·  view source on GitHub ↗
(addr proto.AccountAddress, id proto.DatabaseID)

Source from the content-addressed store, hash-verified

381}
382
383func (s *metaState) createSQLChain(addr proto.AccountAddress, id proto.DatabaseID) error {
384 if _, ok := s.dirty.accounts[addr]; !ok {
385 if _, ok := s.readonly.accounts[addr]; !ok {
386 return ErrAccountNotFound
387 }
388 }
389 if _, ok := s.dirty.databases[id]; ok {
390 return ErrDatabaseExists
391 } else if _, ok := s.readonly.databases[id]; ok {
392 return ErrDatabaseExists
393 }
394 s.dirty.databases[id] = &types.SQLChainProfile{
395 ID: id,
396 Owner: addr,
397 Miners: make(MinerInfos, 0),
398 Users: []*types.SQLChainUser{
399 {
400 Address: addr,
401 Permission: types.UserPermissionFromRole(types.Admin),
402 },
403 },
404 }
405 return nil
406}
407
408func (s *metaState) addSQLChainUser(
409 k proto.DatabaseID, addr proto.AccountAddress, perm *types.UserPermission) (_ error,

Callers 1

TestMetaStateFunction · 0.80

Calls 1

UserPermissionFromRoleFunction · 0.92

Tested by 1

TestMetaStateFunction · 0.64