-
Notifications
You must be signed in to change notification settings - Fork 244
Description
in order to utilize the systemd BlockIOReadBandwidth cgroup entity, I need to be able to parse and pass an array of structs that each contain a string and a uint64 a(st). godbus is able to process the type via MakeVariant but the format() function in variant.go returns ["INVALID"] when given an a(st) type.
Am i doing something wrong here passing an array of structs or is there a gap in the parsing?
for example: giving a map of strings (a singular "BlockIOReadBandwidth") to structs map[string][]BlkioBpsThrottle that have the following format:
type BlkioBpsThrottle struct {
Device string
Throttle uint64
}
and using the following loop to parse a map of length 1 with the device 8:16 and the throttle 2097152:
for k, v := range structMap {
val := dbus.MakeVariant(v)
fmt.Println(reflect.ValueOf(v), val.Signature(), val.Value(), val.String())
p := systemdDbus.Property{
Name: k,
Value: val,
}
properties = append(properties, p)
}
results in: [{8:16 2097152}] a(st) [{8:16 2097152}] ["INVALID"]
the .String() function calls format() which has no handling for either a or (..). I have also noticed that MakeVariant seems to recursively call getSignature on a(st) even further confusing the output.
a(st) is a valid type according to: https://man7.org/linux/man-pages/man5/org.freedesktop.systemd1.5.html and looking at: https://dbus.freedesktop.org/doc/dbus-specification.html#type-system can be interpreted as an array of structs that contains a string and an int.
Not sure if I hit a new use case or if my interpretation here is incorrect.