Skip to content

store: add keychain package#25

Merged
Benehiko merged 3 commits intomainfrom
keychain-interfaces
Jun 23, 2025
Merged

store: add keychain package#25
Benehiko merged 3 commits intomainfrom
keychain-interfaces

Conversation

@Benehiko
Copy link
Member

@Benehiko Benehiko commented Jun 20, 2025

Required by #16

This patch adds the keychain package inside the store module, but does not implement an actual underlying keychain provider.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
@Benehiko Benehiko force-pushed the keychain-interfaces branch from 0652beb to 19b8ac7 Compare June 23, 2025 10:03
@Benehiko Benehiko changed the title Add keychain module store: add keychain package Jun 23, 2025

// Erase implements secrets.Store.
func (k *keychainStore[T]) Delete(ctx context.Context, id store.ID) error {
panic("unimplemented")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the point of these. Is it just documentation purpose? Or do you tend to implement them later?

I don't see much value in the code as is, but maybe I'm missing something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's to satisfy the store.Store interface. The actual implementation has been done somewhere else. I just wanted to break up some of the PR.

)

type MockStore struct {
lock sync.RWMutex
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: m (at least in piñata we always name this m)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure I understand why m is better than lock, sounds too obscure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searching through containerd/containerd I see a lot of lock being used. Other variations are also used: mu, m, l and rwlock.

store map[store.ID]store.Secret
}

func (m *MockStore) init() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s (if we'd go with renaming lock to m)

store map[store.ID]store.Secret
}

func (m *MockStore) init() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not have a new function instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new is a keyword in Go

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I meant newSomething, eg newMockStore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rename it to tryInit instead. newSomething sounds like it will return a new object

Benehiko added 2 commits June 23, 2025 12:22
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Copy link
Collaborator

@joe0BAB joe0BAB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (I'd still prefer not having the init function on the mock, but it's not blocking to me)

@Benehiko Benehiko merged commit 8be0587 into main Jun 23, 2025
12 checks passed
@Benehiko Benehiko deleted the keychain-interfaces branch June 24, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants