Change ACL to Acl

This commit is contained in:
mcrakhman committed 2022-12-26 17:52:39 +01:00
1 parent d35d5c9437
commit 9da4e0e7e9
51 files changed
+1039 -1039

No files matched your search

+10 -10
View File
@@ -11,7 +11,7 @@ type listStorage struct {
db *pogreb.DB
keys aclKeys
id string
root *aclrecordproto.RawACLRecordWithId
root *aclrecordproto.RawAclRecordWithId
}
func newListStorage(db *pogreb.DB) (ls liststorage.ListStorage, err error) {
@@ -21,7 +21,7 @@ func newListStorage(db *pogreb.DB) (ls liststorage.ListStorage, err error) {
return
}
if rootId == nil {
err = liststorage.ErrUnknownACLId
err = liststorage.ErrUnknownAclId
return
}
@@ -30,11 +30,11 @@ func newListStorage(db *pogreb.DB) (ls liststorage.ListStorage, err error) {
return
}
if root == nil {
err = liststorage.ErrUnknownACLId
err = liststorage.ErrUnknownAclId
return
}
rootWithId := &aclrecordproto.RawACLRecordWithId{
rootWithId := &aclrecordproto.RawAclRecordWithId{
Payload: root,
Id: string(rootId),
}
@@ -48,7 +48,7 @@ func newListStorage(db *pogreb.DB) (ls liststorage.ListStorage, err error) {
return
}
func createListStorage(db *pogreb.DB, root *aclrecordproto.RawACLRecordWithId) (ls liststorage.ListStorage, err error) {
func createListStorage(db *pogreb.DB, root *aclrecordproto.RawAclRecordWithId) (ls liststorage.ListStorage, err error) {
keys := aclKeys{}
has, err := db.Has(keys.RootIdKey())
if err != nil {
@@ -86,7 +86,7 @@ func (l *listStorage) Id() string {
return l.id
}
func (l *listStorage) Root() (*aclrecordproto.RawACLRecordWithId, error) {
func (l *listStorage) Root() (*aclrecordproto.RawAclRecordWithId, error) {
return l.root, nil
}
@@ -96,14 +96,14 @@ func (l *listStorage) Head() (head string, err error) {
return
}
if bytes == nil {
err = liststorage.ErrUnknownACLId
err = liststorage.ErrUnknownAclId
return
}
head = string(bytes)
return
}
func (l *listStorage) GetRawRecord(ctx context.Context, id string) (raw *aclrecordproto.RawACLRecordWithId, err error) {
func (l *listStorage) GetRawRecord(ctx context.Context, id string) (raw *aclrecordproto.RawAclRecordWithId, err error) {
res, err := l.db.Get(l.keys.RawRecordKey(id))
if err != nil {
return
@@ -113,7 +113,7 @@ func (l *listStorage) GetRawRecord(ctx context.Context, id string) (raw *aclreco
return
}
raw = &aclrecordproto.RawACLRecordWithId{
raw = &aclrecordproto.RawAclRecordWithId{
Payload: res,
Id: id,
}
@@ -124,6 +124,6 @@ func (l *listStorage) SetHead(headId string) (err error) {
return l.db.Put(l.keys.HeadIdKey(), []byte(headId))
}
func (l *listStorage) AddRawRecord(ctx context.Context, rec *aclrecordproto.RawACLRecordWithId) error {
func (l *listStorage) AddRawRecord(ctx context.Context, rec *aclrecordproto.RawAclRecordWithId) error {
return l.db.Put(l.keys.RawRecordKey(rec.Id), rec.Payload)
}
+4 -4
View File
@@ -8,7 +8,7 @@ import (
"testing"
)
func testList(t *testing.T, store liststorage.ListStorage, root *aclrecordproto.RawACLRecordWithId, head string) {
func testList(t *testing.T, store liststorage.ListStorage, root *aclrecordproto.RawAclRecordWithId, head string) {
require.Equal(t, store.Id(), root.Id)
aclRoot, err := store.Root()
@@ -25,7 +25,7 @@ func TestListStorage_Create(t *testing.T) {
fx.open(t)
defer fx.stop(t)
aclRoot := &aclrecordproto.RawACLRecordWithId{Payload: []byte("root"), Id: "someRootId"}
aclRoot := &aclrecordproto.RawAclRecordWithId{Payload: []byte("root"), Id: "someRootId"}
listStore, err := createListStorage(fx.db, aclRoot)
require.NoError(t, err)
testList(t, listStore, aclRoot, aclRoot.Id)
@@ -41,7 +41,7 @@ func TestListStorage_Create(t *testing.T) {
func TestListStorage_Methods(t *testing.T) {
fx := newFixture(t)
fx.open(t)
aclRoot := &aclrecordproto.RawACLRecordWithId{Payload: []byte("root"), Id: "someRootId"}
aclRoot := &aclrecordproto.RawAclRecordWithId{Payload: []byte("root"), Id: "someRootId"}
_, err := createListStorage(fx.db, aclRoot)
require.NoError(t, err)
fx.stop(t)
@@ -61,7 +61,7 @@ func TestListStorage_Methods(t *testing.T) {
})
t.Run("add raw record and get raw record", func(t *testing.T) {
newRec := &aclrecordproto.RawACLRecordWithId{Payload: []byte("rec"), Id: "someRecId"}
newRec := &aclrecordproto.RawAclRecordWithId{Payload: []byte("rec"), Id: "someRecId"}
require.NoError(t, listStore.AddRawRecord(context.Background(), newRec))
aclRec, err := listStore.GetRawRecord(context.Background(), newRec.Id)
require.NoError(t, err)
+1 -1
View File
@@ -182,7 +182,7 @@ func (s *spaceStorage) CreateTreeStorage(payload treestorage.TreeStorageCreatePa
return createTreeStorage(s.objDb, payload)
}
func (s *spaceStorage) ACLStorage() (liststorage.ListStorage, error) {
func (s *spaceStorage) AclStorage() (liststorage.ListStorage, error) {
return s.aclStorage, nil
}
+2 -2
View File
@@ -17,7 +17,7 @@ func spaceTestPayload() spacestorage.SpaceStorageCreatePayload {
RawHeader: []byte("header"),
Id: "headerId",
}
aclRoot := &aclrecordproto.RawACLRecordWithId{
aclRoot := &aclrecordproto.RawAclRecordWithId{
Payload: []byte("aclRoot"),
Id: "aclRootId",
}
@@ -37,7 +37,7 @@ func testSpace(t *testing.T, store spacestorage.SpaceStorage, payload spacestora
require.NoError(t, err)
require.Equal(t, payload.SpaceHeaderWithId, header)
aclStorage, err := store.ACLStorage()
aclStorage, err := store.AclStorage()
require.NoError(t, err)
testList(t, aclStorage, payload.AclWithId, payload.AclWithId.Id)
}