Skip to content

Commit

Permalink
minor checks
Browse files Browse the repository at this point in the history
  • Loading branch information
asabya committed Oct 24, 2024
1 parent dcec20e commit 6141ee8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/act/grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
)

func (t *ACT) GrantAccess(actName string, address swarm.Address) (*Content, error) {
if actName == "" {
return nil, fmt.Errorf("act name is required")
}

t.mu.Lock()
defer t.mu.Unlock()

Expand Down Expand Up @@ -60,6 +64,10 @@ func (t *ACT) GrantAccess(actName string, address swarm.Address) (*Content, erro
}

func (t *ACT) GetPodAccess(actName string) (swarm.Address, error) {
if actName == "" {
return swarm.ZeroAddress, fmt.Errorf("act name is required")
}

t.mu.Lock()
defer t.mu.Unlock()

Expand Down Expand Up @@ -93,6 +101,10 @@ func (t *ACT) GetPodAccess(actName string) (swarm.Address, error) {
}

func (t *ACT) SaveGrantedPod(actName string, c *Content) error {
if actName == "" {
return fmt.Errorf("act name is required")
}

t.mu.Lock()
defer t.mu.Unlock()

Expand Down Expand Up @@ -121,6 +133,10 @@ func (t *ACT) SaveGrantedPod(actName string, c *Content) error {
}

func (t *ACT) GetGrantees(actName string) ([]string, error) {
if actName == "" {
return nil, fmt.Errorf("act name is required")
}

t.mu.Lock()
defer t.mu.Unlock()

Expand All @@ -140,6 +156,10 @@ func (t *ACT) GetGrantees(actName string) ([]string, error) {
}

func (t *ACT) GetContentList(actName string) ([]*Content, error) {
if actName == "" {
return nil, fmt.Errorf("act name is required")
}

t.mu.Lock()
defer t.mu.Unlock()

Expand Down
8 changes: 8 additions & 0 deletions pkg/act/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ type Content struct {
}

func (t *ACT) CreateUpdateACT(actName string, publicKeyGrant, publicKeyRevoke *ecdsa.PublicKey) (*Act, error) {
if actName == "" {
return nil, fmt.Errorf("act name is required")
}

t.mu.Lock()
defer t.mu.Unlock()

Expand Down Expand Up @@ -126,6 +130,10 @@ func (t *ACT) CreateUpdateACT(actName string, publicKeyGrant, publicKeyRevoke *e
}

func (t *ACT) GetACT(actName string) (*Act, error) {
if actName == "" {
return nil, fmt.Errorf("act name is required")
}

t.mu.Lock()
defer t.mu.Unlock()

Expand Down

0 comments on commit 6141ee8

Please sign in to comment.