recursion flags set up

This commit is contained in:
brent s. 2021-12-15 04:16:06 -05:00
parent ebe91c867c
commit 8d81c5f0cc
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
4 changed files with 106 additions and 1 deletions

View File

@ -163,3 +163,92 @@ const (
// DbusPath is the path for DbusService.
DbusPath string = "/modules/kwalletd5"
)

// Recursion options.

/*
RecurseNone specifies that no recursion should be done.
If present, it takes precedent over all over RecurseOptsFlags present.

Performed in/from:
WalletManager
Wallet
Folder
(WalletItem)
*/
const RecurseNone RecurseOptsFlag = 0
const (
/*
RecurseWallet indicates that Wallet objects should have Wallet.Update called.

Performed in/from: WalletManager
*/
RecurseWallet RecurseOptsFlag = 1 << iota
/*
RecurseFolder indicates that Folder objects should have Folder.Update called.

Performed in/from:
Wallet

May be performed in/from (depending on other flags):
WalletManager
*/
RecurseFolder
/*
RecurseWalletItem indicates that all WalletItem entries should have (WalletItem).Update() called.
If present, it takes precedent over all over relevant RecurseOptsFlags present
(RecursePassword, RecurseMap, RecurseBlob, RecurseUnknown).

Performed in/from:
Folder

May be performed in/from (depending on other flags):
WalletManager
Wallet
*/
RecurseWalletItem
/*
RecursePassword indicates that Password objects should have Password.Update() called.

Performed in/from:
Folder

May be performed in/from (depending on other flags):
WalletManager
Wallet
*/
RecursePassword
/*
RecurseMap indicates that Map objects should have Map.Update() called.

Performed in/from:
Folder

May be performed in/from (depending on other flags):
WalletManager
Wallet
*/
RecurseMap
/*
RecurseBlob indicates that Blob objects should have Blob.Update() called.

Performed in/from:
Folder

May be performed in/from (depending on other flags):
WalletManager
Wallet
*/
RecurseBlob
/*
RecurseUnknown indicates that UnknownItem objects should have UnknownItem.Update() called.

Performed in/from:
Folder

May be performed in/from (depending on other flags):
WalletManager
Wallet
*/
RecurseUnknown
)

5
go.mod
View File

@ -2,4 +2,7 @@ module r00t2.io/gokwallet

go 1.17

require github.com/godbus/dbus/v5 v5.0.6
require (
github.com/godbus/dbus/v5 v5.0.6
r00t2.io/goutils v1.0.1
)

5
go.sum
View File

@ -1,2 +1,7 @@
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro=
github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/jszwec/csvutil v1.5.0/go.mod h1:Rpu7Uu9giO9subDyMCIQfHVDuLrcaC36UA4YcJjGBkg=
r00t2.io/goutils v1.0.1 h1:f1m2QRBF8XsW3peYf1I2q37npgf+5bmJBbrLzCFtm34=
r00t2.io/goutils v1.0.1/go.mod h1:CMK3RGnMSyjDSfYxeFQl/oJTkkUMS1jhSTdGTkAPpQw=
r00t2.io/sysutils v0.0.0-20210224054841-55ac47c86928/go.mod h1:XzJkBF6SHAODEszJlOcjtGoTHwYnZZNmseA6PyOujes=

View File

@ -2,6 +2,7 @@ package gokwallet

import (
"github.com/godbus/dbus/v5"
"r00t2.io/goutils/types"
)

/*
@ -131,3 +132,10 @@ type UnknownItem struct {
type WalletItem interface {
isWalletItem() (isWalletItem bool)
}

/*
RecurseOptsFlag is used to determine whether or not to recurse into items and fully populate them.
One would use a types.BitMask as a parameter type and do <BitMask>.HasFlag(<RecurseOptsFlag>).
See consts.go for the actual flags.
*/
type RecurseOptsFlag types.MaskBit