diff --git a/go.mod b/go.mod index 9c897d3..363d7af 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/mitchellh/hashstructure/v2 v2.0.2 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.31.0 - github.com/rs/zerolog v1.31.0 github.com/samber/lo v1.38.1 github.com/stretchr/testify v1.8.4 go.etcd.io/bbolt v1.3.8 diff --git a/go.sum b/go.sum index 6c0d397..ca3c82f 100644 --- a/go.sum +++ b/go.sum @@ -208,8 +208,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= diff --git a/magefiles/go.mod b/magefiles/go.mod index a91eba2..b36c733 100644 --- a/magefiles/go.mod +++ b/magefiles/go.mod @@ -11,22 +11,18 @@ require ( github.com/OneOfOne/xxhash v1.2.8 // indirect github.com/aserto-dev/clui v0.8.3 // indirect github.com/fatih/color v1.15.0 // indirect - github.com/aserto-dev/clui v0.8.3 // indirect - github.com/fatih/color v1.15.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gitleaks/go-gitdiff v0.7.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/kyokomi/emoji v2.2.4+incompatible // indirect github.com/magiconair/properties v1.8.7 // indirect - github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect @@ -36,10 +32,8 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.16.0 // indirect - github.com/spf13/viper v1.16.0 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect - github.com/subosito/gotenv v1.4.2 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/zricethezav/gitleaks/v8 v8.3.0 // indirect golang.org/x/sync v0.4.0 // indirect diff --git a/magefiles/go.sum b/magefiles/go.sum index 184055a..b294f3d 100644 --- a/magefiles/go.sum +++ b/magefiles/go.sum @@ -42,8 +42,6 @@ github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8 github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/aserto-dev/clui v0.8.3 h1:foEJuVpMFVP4La3SxUcinxRLOZx/TyS2BRuahbywYFg= github.com/aserto-dev/clui v0.8.3/go.mod h1:KsL/g2x5LAbkEE4ofW/ZoA4FDOIdAyLes/5ullvzUt8= -github.com/aserto-dev/clui v0.8.3 h1:foEJuVpMFVP4La3SxUcinxRLOZx/TyS2BRuahbywYFg= -github.com/aserto-dev/clui v0.8.3/go.mod h1:KsL/g2x5LAbkEE4ofW/ZoA4FDOIdAyLes/5ullvzUt8= github.com/aserto-dev/mage-loot v0.8.15 h1:tSYfLLkRqJ37YW/mQxnIeqlVv5TJw7o8NaKfXios0Wc= github.com/aserto-dev/mage-loot v0.8.15/go.mod h1:Oi7gxbSzxC4qlCMUaiNHWLE1DjmcMTk96fzFHNN/bsc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -67,9 +65,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gitleaks/go-gitdiff v0.7.4 h1:8vICc4moyRR2poklblThdQ0ckMet22mEvFJSxPsiDlk= @@ -156,8 +151,6 @@ github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -166,16 +159,12 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= @@ -185,8 +174,6 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= @@ -203,8 +190,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -215,13 +200,10 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -243,7 +225,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -309,7 +290,6 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -364,7 +344,6 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -386,10 +365,6 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/pkg/bdb/boltdb.go b/pkg/bdb/boltdb.go index 19bb5df..20840c5 100644 --- a/pkg/bdb/boltdb.go +++ b/pkg/bdb/boltdb.go @@ -30,8 +30,6 @@ type Config struct { RequestTimeout time.Duration MaxBatchSize int MaxBatchDelay time.Duration - MaxBatchSize int - MaxBatchDelay time.Duration } // BoltDB based key-value store. diff --git a/pkg/bdb/migrate/mig002/migrate.go b/pkg/bdb/migrate/mig002/migrate.go index 8b11f76..5f9c008 100644 --- a/pkg/bdb/migrate/mig002/migrate.go +++ b/pkg/bdb/migrate/mig002/migrate.go @@ -36,14 +36,12 @@ func MigrationVersion() *semver.Version { } type modelType interface { - *dsc2.ObjectType | *dsc2.RelationType | *dsc2.Permission *dsc2.ObjectType | *dsc2.RelationType | *dsc2.Permission proto.Message GetName() string } type objectType interface { - *dsc2.Object *dsc2.Object proto.Message GetType() string @@ -52,14 +50,11 @@ type objectType interface { } type relationType interface { - *dsc2.Relation *dsc2.Relation proto.Message GetSubject() *dsc2.ObjectIdentifier - GetSubject() *dsc2.ObjectIdentifier GetRelation() string GetObject() *dsc2.ObjectIdentifier - GetObject() *dsc2.ObjectIdentifier } var fnMap = []func(*zerolog.Logger, *bolt.DB, *bolt.DB) error{ @@ -67,25 +62,21 @@ var fnMap = []func(*zerolog.Logger, *bolt.DB, *bolt.DB) error{ mig.DeleteBucket(ObjectTypesNamePath), mig.CreateBucket(bdb.ObjectTypesPath), updateModelTypes(bdb.ObjectTypesPath, &dsc2.ObjectType{}), - updateModelTypes(bdb.ObjectTypesPath, &dsc2.ObjectType{}), mig.DeleteBucket(bdb.RelationTypesPath), mig.DeleteBucket(RelationTypesNamePath), mig.CreateBucket(bdb.RelationTypesPath), updateModelTypes(bdb.RelationTypesPath, &dsc2.RelationType{}), - updateModelTypes(bdb.RelationTypesPath, &dsc2.RelationType{}), mig.DeleteBucket(bdb.PermissionsPath), mig.DeleteBucket(PermissionsNamePath), mig.CreateBucket(bdb.PermissionsPath), updateModelTypes(bdb.PermissionsPath, &dsc2.Permission{}), - updateModelTypes(bdb.PermissionsPath, &dsc2.Permission{}), mig.DeleteBucket(bdb.ObjectsPath), mig.DeleteBucket(ObjectsKeyPath), mig.CreateBucket(bdb.ObjectsPath), updateObjects(bdb.ObjectsPath, &dsc2.Object{}), - updateObjects(bdb.ObjectsPath, &dsc2.Object{}), mig.DeleteBucket(bdb.RelationsObjPath), mig.DeleteBucket(bdb.RelationsSubPath), @@ -155,13 +146,10 @@ func updateModelTypes[T modelType](path bdb.Path, v T) func(*zerolog.Logger, *bo func keyModelType[T modelType](v T) []byte { var i interface{} = v switch msg := i.(type) { - case *dsc2.ObjectType: case *dsc2.ObjectType: return []byte(msg.GetName()) - case *dsc2.Permission: case *dsc2.Permission: return []byte(msg.GetName()) - case *dsc2.RelationType: case *dsc2.RelationType: return []byte(msg.GetObjectType() + ds.TypeIDSeparator + msg.GetName()) } diff --git a/pkg/directory/v2/exporter.go b/pkg/directory/v2/exporter.go index 1038943..390ea04 100644 --- a/pkg/directory/v2/exporter.go +++ b/pkg/directory/v2/exporter.go @@ -25,7 +25,6 @@ func NewExporter(logger *zerolog.Logger, store *bdb.BoltDB, e3 *v3.Exporter) *Ex } } -func (s *Exporter) Export(req *dse2.ExportRequest, stream dse2.Exporter_ExportServer) error { func (s *Exporter) Export(req *dse2.ExportRequest, stream dse2.Exporter_ExportServer) error { logger := s.logger.With().Str("method", "Export").Interface("req", req).Logger() @@ -58,7 +57,6 @@ func (s *Exporter) Export(req *dse2.ExportRequest, stream dse2.Exporter_ExportSe } } - if req.Options&uint32(dse2.Option_OPTION_DATA_RELATIONS) != 0 { if req.Options&uint32(dse2.Option_OPTION_DATA_RELATIONS) != 0 { if err := exportRelations(tx, stream); err != nil { logger.Error().Err(err).Msg("export_relations") @@ -129,8 +127,6 @@ func exportPermissions(store *bdb.BoltDB, stream dse2.Exporter_ExportServer) err return nil } -func exportObjects(tx *bolt.Tx, stream dse2.Exporter_ExportServer) error { - iter, err := bdb.NewScanIterator[dsc2.Object](stream.Context(), tx, bdb.ObjectsPath) func exportObjects(tx *bolt.Tx, stream dse2.Exporter_ExportServer) error { iter, err := bdb.NewScanIterator[dsc2.Object](stream.Context(), tx, bdb.ObjectsPath) if err != nil { @@ -138,8 +134,6 @@ func exportObjects(tx *bolt.Tx, stream dse2.Exporter_ExportServer) error { } for iter.Next() { - if err := stream.Send(&dse2.ExportResponse{ - Msg: &dse2.ExportResponse_Object{ if err := stream.Send(&dse2.ExportResponse{ Msg: &dse2.ExportResponse_Object{ Object: iter.Value(), @@ -152,8 +146,6 @@ func exportObjects(tx *bolt.Tx, stream dse2.Exporter_ExportServer) error { return nil } -func exportRelations(tx *bolt.Tx, stream dse2.Exporter_ExportServer) error { - iter, err := bdb.NewScanIterator[dsc2.Relation](stream.Context(), tx, bdb.RelationsObjPath) func exportRelations(tx *bolt.Tx, stream dse2.Exporter_ExportServer) error { iter, err := bdb.NewScanIterator[dsc2.Relation](stream.Context(), tx, bdb.RelationsObjPath) if err != nil { @@ -161,8 +153,6 @@ func exportRelations(tx *bolt.Tx, stream dse2.Exporter_ExportServer) error { } for iter.Next() { - if err := stream.Send(&dse2.ExportResponse{ - Msg: &dse2.ExportResponse_Relation{ if err := stream.Send(&dse2.ExportResponse{ Msg: &dse2.ExportResponse_Relation{ Relation: iter.Value(), diff --git a/pkg/directory/v2/importer.go b/pkg/directory/v2/importer.go index b502923..ea8d425 100644 --- a/pkg/directory/v2/importer.go +++ b/pkg/directory/v2/importer.go @@ -34,13 +34,6 @@ func NewImporter(logger *zerolog.Logger, store *bdb.BoltDB, i3 *v3.Importer) *Im } } -func (s *Importer) Import(stream dsi2.Importer_ImportServer) error { - res := &dsi2.ImportResponse{ - ObjectType: &dsi2.ImportCounter{}, - Permission: &dsi2.ImportCounter{}, - RelationType: &dsi2.ImportCounter{}, - Object: &dsi2.ImportCounter{}, - Relation: &dsi2.ImportCounter{}, func (s *Importer) Import(stream dsi2.Importer_ImportServer) error { res := &dsi2.ImportResponse{ ObjectType: &dsi2.ImportCounter{}, @@ -55,10 +48,6 @@ func (s *Importer) Import(stream dsi2.Importer_ImportServer) error { s.store.DB().MaxBatchSize = s.store.Config().MaxBatchSize s.store.DB().MaxBatchDelay = s.store.Config().MaxBatchDelay - importErr := s.store.DB().Batch(func(tx *bolt.Tx) error { - s.store.DB().MaxBatchSize = s.store.Config().MaxBatchSize - s.store.DB().MaxBatchDelay = s.store.Config().MaxBatchDelay - importErr := s.store.DB().Batch(func(tx *bolt.Tx) error { for { req, err := stream.Recv() @@ -80,7 +69,6 @@ func (s *Importer) Import(stream dsi2.Importer_ImportServer) error { return importErr } -func (s *Importer) handleImportRequest(ctx context.Context, tx *bolt.Tx, req *dsi2.ImportRequest, res *dsi2.ImportResponse) (err error) { func (s *Importer) handleImportRequest(ctx context.Context, tx *bolt.Tx, req *dsi2.ImportRequest, res *dsi2.ImportResponse) (err error) { if obj := req.GetObject(); obj != nil { @@ -114,7 +102,6 @@ func (s *Importer) objectHandler(ctx context.Context, tx *bolt.Tx, req *dsc2.Obj return nil } -func (s *Importer) relationHandler(ctx context.Context, tx *bolt.Tx, req *dsc2.Relation) error { func (s *Importer) relationHandler(ctx context.Context, tx *bolt.Tx, req *dsc2.Relation) error { s.logger.Debug().Interface("relation", req).Msg("import_relation") @@ -135,13 +122,10 @@ func (s *Importer) relationHandler(ctx context.Context, tx *bolt.Tx, req *dsc2.R return nil } -func updateCounter(c *dsi2.ImportCounter, opCode dsi2.Opcode, err error) *dsi2.ImportCounter { func updateCounter(c *dsi2.ImportCounter, opCode dsi2.Opcode, err error) *dsi2.ImportCounter { c.Recv++ - if opCode == dsi2.Opcode_OPCODE_SET { if opCode == dsi2.Opcode_OPCODE_SET { c.Set++ - } else if opCode == dsi2.Opcode_OPCODE_DELETE { } else if opCode == dsi2.Opcode_OPCODE_DELETE { c.Delete++ } diff --git a/pkg/directory/v2/reader.go b/pkg/directory/v2/reader.go index b1ea06e..7c621af 100644 --- a/pkg/directory/v2/reader.go +++ b/pkg/directory/v2/reader.go @@ -30,8 +30,6 @@ func NewReader(logger *zerolog.Logger, store *bdb.BoltDB, r3 *v3.Reader) *Reader } // Get object type (metadata). -func (s *Reader) GetObjectType(ctx context.Context, req *dsr2.GetObjectTypeRequest) (*dsr2.GetObjectTypeResponse, error) { - resp := &dsr2.GetObjectTypeResponse{} func (s *Reader) GetObjectType(ctx context.Context, req *dsr2.GetObjectTypeRequest) (*dsr2.GetObjectTypeResponse, error) { resp := &dsr2.GetObjectTypeResponse{} @@ -50,14 +48,11 @@ func (s *Reader) GetObjectType(ctx context.Context, req *dsr2.GetObjectTypeReque } // Get all objects types (metadata) (paginated). -func (s *Reader) GetObjectTypes(ctx context.Context, req *dsr2.GetObjectTypesRequest) (*dsr2.GetObjectTypesResponse, error) { - resp := &dsr2.GetObjectTypesResponse{Results: []*dsc2.ObjectType{}} func (s *Reader) GetObjectTypes(ctx context.Context, req *dsr2.GetObjectTypesRequest) (*dsr2.GetObjectTypesResponse, error) { resp := &dsr2.GetObjectTypesResponse{Results: []*dsc2.ObjectType{}} if req.Page == nil { req.Page = &dsc2.PaginationRequest{Size: 100} - req.Page = &dsc2.PaginationRequest{Size: 100} } objectTypes, err := s.store.MC().GetObjectTypes() @@ -72,8 +67,6 @@ func (s *Reader) GetObjectTypes(ctx context.Context, req *dsr2.GetObjectTypesReq } // Get relation type (metadata). -func (s *Reader) GetRelationType(ctx context.Context, req *dsr2.GetRelationTypeRequest) (*dsr2.GetRelationTypeResponse, error) { - resp := &dsr2.GetRelationTypeResponse{} func (s *Reader) GetRelationType(ctx context.Context, req *dsr2.GetRelationTypeRequest) (*dsr2.GetRelationTypeResponse, error) { resp := &dsr2.GetRelationTypeResponse{} @@ -95,8 +88,6 @@ func (s *Reader) GetRelationType(ctx context.Context, req *dsr2.GetRelationTypeR } // Get all relation types, optionally filtered by object type (metadata) (paginated). -func (s *Reader) GetRelationTypes(ctx context.Context, req *dsr2.GetRelationTypesRequest) (*dsr2.GetRelationTypesResponse, error) { - resp := &dsr2.GetRelationTypesResponse{Results: []*dsc2.RelationType{}, Page: &dsc2.PaginationResponse{}} func (s *Reader) GetRelationTypes(ctx context.Context, req *dsr2.GetRelationTypesRequest) (*dsr2.GetRelationTypesResponse, error) { resp := &dsr2.GetRelationTypesResponse{Results: []*dsc2.RelationType{}, Page: &dsc2.PaginationResponse{}} @@ -106,7 +97,6 @@ func (s *Reader) GetRelationTypes(ctx context.Context, req *dsr2.GetRelationType if req.Page == nil { req.Page = &dsc2.PaginationRequest{Size: 100} - req.Page = &dsc2.PaginationRequest{Size: 100} } relationTypes, err := s.store.MC().GetRelationTypes(req.Param.GetName()) @@ -124,8 +114,6 @@ func (s *Reader) GetRelationTypes(ctx context.Context, req *dsr2.GetRelationType } // Get permission (metadata). -func (s *Reader) GetPermission(ctx context.Context, req *dsr2.GetPermissionRequest) (*dsr2.GetPermissionResponse, error) { - resp := &dsr2.GetPermissionResponse{} func (s *Reader) GetPermission(ctx context.Context, req *dsr2.GetPermissionRequest) (*dsr2.GetPermissionResponse, error) { resp := &dsr2.GetPermissionResponse{} @@ -146,14 +134,11 @@ func (s *Reader) GetPermission(ctx context.Context, req *dsr2.GetPermissionReque } // Get all permissions (metadata) (paginated). -func (s *Reader) GetPermissions(ctx context.Context, req *dsr2.GetPermissionsRequest) (*dsr2.GetPermissionsResponse, error) { - resp := &dsr2.GetPermissionsResponse{Results: []*dsc2.Permission{}} func (s *Reader) GetPermissions(ctx context.Context, req *dsr2.GetPermissionsRequest) (*dsr2.GetPermissionsResponse, error) { resp := &dsr2.GetPermissionsResponse{Results: []*dsc2.Permission{}} if req.Page == nil { req.Page = &dsc2.PaginationRequest{Size: 100} - req.Page = &dsc2.PaginationRequest{Size: 100} } permissions, err := s.store.MC().GetPermissions()