chore(dependencies): bump reva

This commit is contained in:
fschade
2025-08-14 17:27:38 +02:00
parent b2c87793b5
commit db5fbf4237
104 changed files with 2503 additions and 1155 deletions
+13 -13
View File
@@ -56,7 +56,7 @@ require (
github.com/mna/pigeon v1.3.0 github.com/mna/pigeon v1.3.0
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/nats-io/nats-server/v2 v2.11.7 github.com/nats-io/nats-server/v2 v2.11.7
github.com/nats-io/nats.go v1.43.0 github.com/nats-io/nats.go v1.44.0
github.com/oklog/run v1.2.0 github.com/oklog/run v1.2.0
github.com/olekukonko/tablewriter v1.0.8 github.com/olekukonko/tablewriter v1.0.8
github.com/onsi/ginkgo v1.16.5 github.com/onsi/ginkgo v1.16.5
@@ -64,7 +64,7 @@ require (
github.com/onsi/gomega v1.38.0 github.com/onsi/gomega v1.38.0
github.com/open-policy-agent/opa v1.6.0 github.com/open-policy-agent/opa v1.6.0
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76
github.com/opencloud-eu/reva/v2 v2.36.0 github.com/opencloud-eu/reva/v2 v2.36.1-0.20250814151758-19625996460b
github.com/orcaman/concurrent-map v1.0.0 github.com/orcaman/concurrent-map v1.0.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/pkg/xattr v0.4.12 github.com/pkg/xattr v0.4.12
@@ -97,17 +97,17 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0
go.opentelemetry.io/otel/sdk v1.37.0 go.opentelemetry.io/otel/sdk v1.37.0
go.opentelemetry.io/otel/trace v1.37.0 go.opentelemetry.io/otel/trace v1.37.0
golang.org/x/crypto v0.40.0 golang.org/x/crypto v0.41.0
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac
golang.org/x/image v0.30.0 golang.org/x/image v0.30.0
golang.org/x/net v0.42.0 golang.org/x/net v0.42.0
golang.org/x/oauth2 v0.30.0 golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.16.0 golang.org/x/sync v0.16.0
golang.org/x/term v0.33.0 golang.org/x/term v0.34.0
golang.org/x/text v0.28.0 golang.org/x/text v0.28.0
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822
google.golang.org/grpc v1.74.0 google.golang.org/grpc v1.74.0
google.golang.org/protobuf v1.36.6 google.golang.org/protobuf v1.36.7
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.5.2 gotest.tools/v3 v3.5.2
stash.kopano.io/kgol/rndm v1.1.2 stash.kopano.io/kgol/rndm v1.1.2
@@ -238,7 +238,7 @@ require (
github.com/juliangruber/go-intersect v1.1.0 // indirect github.com/juliangruber/go-intersect v1.1.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect github.com/klauspost/cpuid/v2 v2.2.11 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/libregraph/oidc-go v1.1.0 // indirect github.com/libregraph/oidc-go v1.1.0 // indirect
github.com/longsleep/go-metrics v1.0.0 // indirect github.com/longsleep/go-metrics v1.0.0 // indirect
@@ -252,10 +252,10 @@ require (
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 // indirect github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 // indirect
github.com/miekg/dns v1.1.57 // indirect github.com/miekg/dns v1.1.57 // indirect
github.com/mileusna/useragent v1.3.5 // indirect github.com/mileusna/useragent v1.3.5 // indirect
github.com/minio/crc64nvme v1.0.1 // indirect github.com/minio/crc64nvme v1.0.2 // indirect
github.com/minio/highwayhash v1.0.3 // indirect github.com/minio/highwayhash v1.0.3 // indirect
github.com/minio/md5-simd v1.1.2 // indirect github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/minio-go/v7 v7.0.94 // indirect github.com/minio/minio-go/v7 v7.0.95 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
@@ -273,7 +273,7 @@ require (
github.com/pablodz/inotifywaitgo v0.0.9 // indirect github.com/pablodz/inotifywaitgo v0.0.9 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect github.com/philhofer/fwd v1.2.0 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect github.com/pierrec/lz4/v4 v4.1.15 // indirect
github.com/pjbgf/sha1cd v0.3.2 // indirect github.com/pjbgf/sha1cd v0.3.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@@ -317,9 +317,9 @@ require (
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/yashtewari/glob-intersection v0.2.0 // indirect github.com/yashtewari/glob-intersection v0.2.0 // indirect
go.etcd.io/etcd/api/v3 v3.6.2 // indirect go.etcd.io/etcd/api/v3 v3.6.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.6.2 // indirect go.etcd.io/etcd/client/pkg/v3 v3.6.4 // indirect
go.etcd.io/etcd/client/v3 v3.6.2 // indirect go.etcd.io/etcd/client/v3 v3.6.4 // indirect
go.opencensus.io v0.24.0 // indirect go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
@@ -329,7 +329,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect go.uber.org/zap v1.27.0 // indirect
golang.org/x/mod v0.26.0 // indirect golang.org/x/mod v0.26.0 // indirect
golang.org/x/sys v0.34.0 // indirect golang.org/x/sys v0.35.0 // indirect
golang.org/x/time v0.12.0 // indirect golang.org/x/time v0.12.0 // indirect
golang.org/x/tools v0.35.0 // indirect golang.org/x/tools v0.35.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
+26 -26
View File
@@ -687,8 +687,8 @@ github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHU
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202 h1:A1xJ2NKgiYFiaHiLl9B5yw/gUBACSs9crDykTS3GuQI= github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202 h1:A1xJ2NKgiYFiaHiLl9B5yw/gUBACSs9crDykTS3GuQI=
github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE= github.com/kobergj/gowebdav v0.0.0-20250102091030-aa65266db202/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
github.com/kolo/xmlrpc v0.0.0-20200310150728-e0350524596b/go.mod h1:o03bZfuBwAXHetKXuInt4S7omeXUu62/A845kiycsSQ= github.com/kolo/xmlrpc v0.0.0-20200310150728-e0350524596b/go.mod h1:o03bZfuBwAXHetKXuInt4S7omeXUu62/A845kiycsSQ=
@@ -777,14 +777,14 @@ github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk= github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
github.com/mileusna/useragent v1.3.5 h1:SJM5NzBmh/hO+4LGeATKpaEX9+b4vcGg2qXGLiNGDws= github.com/mileusna/useragent v1.3.5 h1:SJM5NzBmh/hO+4LGeATKpaEX9+b4vcGg2qXGLiNGDws=
github.com/mileusna/useragent v1.3.5/go.mod h1:3d8TOmwL/5I8pJjyVDteHtgDGcefrFUX4ccGOMKNYYc= github.com/mileusna/useragent v1.3.5/go.mod h1:3d8TOmwL/5I8pJjyVDteHtgDGcefrFUX4ccGOMKNYYc=
github.com/minio/crc64nvme v1.0.1 h1:DHQPrYPdqK7jQG/Ls5CTBZWeex/2FMS3G5XGkycuFrY= github.com/minio/crc64nvme v1.0.2 h1:6uO1UxGAD+kwqWWp7mBFsi5gAse66C4NXO8cmcVculg=
github.com/minio/crc64nvme v1.0.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/crc64nvme v1.0.2/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg=
github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q=
github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
github.com/minio/minio-go/v7 v7.0.94 h1:1ZoksIKPyaSt64AVOyaQvhDOgVC3MfZsWM6mZXRUGtM= github.com/minio/minio-go/v7 v7.0.95 h1:ywOUPg+PebTMTzn9VDsoFJy32ZuARN9zhB+K3IYEvYU=
github.com/minio/minio-go/v7 v7.0.94/go.mod h1:71t2CqDt3ThzESgZUlU1rBN54mksGGlkLcFgguDnnAc= github.com/minio/minio-go/v7 v7.0.95/go.mod h1:wOOX3uxS334vImCNRVyIDdXX9OsXDm89ToynKgqUKlo=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
@@ -823,8 +823,8 @@ github.com/nats-io/jwt/v2 v2.7.4 h1:jXFuDDxs/GQjGDZGhNgH4tXzSUK6WQi2rsj4xmsNOtI=
github.com/nats-io/jwt/v2 v2.7.4/go.mod h1:me11pOkwObtcBNR8AiMrUbtVOUGkqYjMQZ6jnSdVUIA= github.com/nats-io/jwt/v2 v2.7.4/go.mod h1:me11pOkwObtcBNR8AiMrUbtVOUGkqYjMQZ6jnSdVUIA=
github.com/nats-io/nats-server/v2 v2.11.7 h1:lINWQ/Hb3cnaoHmWTjj/7WppZnaSh9C/1cD//nHCbms= github.com/nats-io/nats-server/v2 v2.11.7 h1:lINWQ/Hb3cnaoHmWTjj/7WppZnaSh9C/1cD//nHCbms=
github.com/nats-io/nats-server/v2 v2.11.7/go.mod h1:DchDPVzAsAPqhqm7VLedX0L7hjnV/SYtlmsl9F8U53s= github.com/nats-io/nats-server/v2 v2.11.7/go.mod h1:DchDPVzAsAPqhqm7VLedX0L7hjnV/SYtlmsl9F8U53s=
github.com/nats-io/nats.go v1.43.0 h1:uRFZ2FEoRvP64+UUhaTokyS18XBCR/xM2vQZKO4i8ug= github.com/nats-io/nats.go v1.44.0 h1:ECKVrDLdh/kDPV1g0gAQ+2+m2KprqZK5O/eJAyAnH2M=
github.com/nats-io/nats.go v1.43.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g= github.com/nats-io/nats.go v1.44.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
github.com/nats-io/nkeys v0.4.11 h1:q44qGV008kYd9W1b1nEBkNzvnWxtRSQ7A8BoqRrcfa0= github.com/nats-io/nkeys v0.4.11 h1:q44qGV008kYd9W1b1nEBkNzvnWxtRSQ7A8BoqRrcfa0=
github.com/nats-io/nkeys v0.4.11/go.mod h1:szDimtgmfOi9n25JpfIdGw12tZFYXqhGxjhVxsatHVE= github.com/nats-io/nkeys v0.4.11/go.mod h1:szDimtgmfOi9n25JpfIdGw12tZFYXqhGxjhVxsatHVE=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
@@ -868,8 +868,8 @@ github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-202505121527
github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY= github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 h1:vD/EdfDUrv4omSFjrinT8Mvf+8D7f9g4vgQ2oiDrVUI= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 h1:vD/EdfDUrv4omSFjrinT8Mvf+8D7f9g4vgQ2oiDrVUI=
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q= github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q=
github.com/opencloud-eu/reva/v2 v2.36.0 h1:5FBjhXqW8F4v7F76vGYpH7IGuRtcbKHoyOyj3syG7W8= github.com/opencloud-eu/reva/v2 v2.36.1-0.20250814151758-19625996460b h1:8yoJkKcaI/DXKeUn0lIkkPFzxMOrgnFdI/CYvbYQoOU=
github.com/opencloud-eu/reva/v2 v2.36.0/go.mod h1:/FyYaUWxtllu8TOcIIx53BjChc+hSpcQicBI/OTICjw= github.com/opencloud-eu/reva/v2 v2.36.1-0.20250814151758-19625996460b/go.mod h1:4zNxGNmc4CJ39YBI2vhGr7zTfUxPAV1mkjsBvaODACw=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
@@ -891,8 +891,8 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI= github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI=
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE= github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE=
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c h1:dAMKvw0MlJT1GshSTtih8C2gDs04w8dReiOGXrGLNoY= github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0=
github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
@@ -1157,12 +1157,12 @@ github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.4.2 h1:IrUHp260R8c+zYx/Tm8QZr04CX+qWS5PGfPdevhdm1I= go.etcd.io/bbolt v1.4.2 h1:IrUHp260R8c+zYx/Tm8QZr04CX+qWS5PGfPdevhdm1I=
go.etcd.io/bbolt v1.4.2/go.mod h1:Is8rSHO/b4f3XigBC0lL0+4FwAQv3HXEEIgFMuKHceM= go.etcd.io/bbolt v1.4.2/go.mod h1:Is8rSHO/b4f3XigBC0lL0+4FwAQv3HXEEIgFMuKHceM=
go.etcd.io/etcd/api/v3 v3.6.2 h1:25aCkIMjUmiiOtnBIp6PhNj4KdcURuBak0hU2P1fgRc= go.etcd.io/etcd/api/v3 v3.6.4 h1:7F6N7toCKcV72QmoUKa23yYLiiljMrT4xCeBL9BmXdo=
go.etcd.io/etcd/api/v3 v3.6.2/go.mod h1:eFhhvfR8Px1P6SEuLT600v+vrhdDTdcfMzmnxVXXSbk= go.etcd.io/etcd/api/v3 v3.6.4/go.mod h1:eFhhvfR8Px1P6SEuLT600v+vrhdDTdcfMzmnxVXXSbk=
go.etcd.io/etcd/client/pkg/v3 v3.6.2 h1:zw+HRghi/G8fKpgKdOcEKpnBTE4OO39T6MegA0RopVU= go.etcd.io/etcd/client/pkg/v3 v3.6.4 h1:9HBYrjppeOfFjBjaMTRxT3R7xT0GLK8EJMVC4xg6ok0=
go.etcd.io/etcd/client/pkg/v3 v3.6.2/go.mod h1:sbdzr2cl3HzVmxNw//PH7aLGVtY4QySjQFuaCgcRFAI= go.etcd.io/etcd/client/pkg/v3 v3.6.4/go.mod h1:sbdzr2cl3HzVmxNw//PH7aLGVtY4QySjQFuaCgcRFAI=
go.etcd.io/etcd/client/v3 v3.6.2 h1:RgmcLJxkpHqpFvgKNwAQHX3K+wsSARMXKgjmUSpoSKQ= go.etcd.io/etcd/client/v3 v3.6.4 h1:YOMrCfMhRzY8NgtzUsHl8hC2EBSnuqbR3dh84Uryl7A=
go.etcd.io/etcd/client/v3 v3.6.2/go.mod h1:PL7e5QMKzjybn0FosgiWvCUDzvdChpo5UgGR4Sk4Gzc= go.etcd.io/etcd/client/v3 v3.6.4/go.mod h1:jaNNHCyg2FdALyKWnd7hxZXZxZANb0+KGY+YQaEMISo=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
@@ -1239,8 +1239,8 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 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-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -1448,8 +1448,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -1461,8 +1461,8 @@ golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1642,8 +1642,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y= gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y=
gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI=
+3
View File
@@ -285,6 +285,7 @@ Exit Code 1
| AMXCOMPLEX | Tile computational operations on complex numbers | | AMXCOMPLEX | Tile computational operations on complex numbers |
| AMXTILE | Tile architecture | | AMXTILE | Tile architecture |
| AMXTF32 | Matrix Multiplication of TF32 Tiles into Packed Single Precision Tile | | AMXTF32 | Matrix Multiplication of TF32 Tiles into Packed Single Precision Tile |
| AMXTRANSPOSE | Tile multiply where the first operand is transposed |
| APX_F | Intel APX | | APX_F | Intel APX |
| AVX | AVX functions | | AVX | AVX functions |
| AVX10 | If set the Intel AVX10 Converged Vector ISA is supported | | AVX10 | If set the Intel AVX10 Converged Vector ISA is supported |
@@ -420,6 +421,8 @@ Exit Code 1
| SHA | Intel SHA Extensions | | SHA | Intel SHA Extensions |
| SME | AMD Secure Memory Encryption supported | | SME | AMD Secure Memory Encryption supported |
| SME_COHERENT | AMD Hardware cache coherency across encryption domains enforced | | SME_COHERENT | AMD Hardware cache coherency across encryption domains enforced |
| SM3_X86 | SM3 instructions |
| SM4_X86 | SM4 instructions |
| SPEC_CTRL_SSBD | Speculative Store Bypass Disable | | SPEC_CTRL_SSBD | Speculative Store Bypass Disable |
| SRBDS_CTRL | SRBDS mitigation MSR available | | SRBDS_CTRL | SRBDS mitigation MSR available |
| SSE | SSE functions | | SSE | SSE functions |
+13 -2
View File
@@ -85,6 +85,7 @@ const (
AMXTILE // Tile architecture AMXTILE // Tile architecture
AMXTF32 // Tile architecture AMXTF32 // Tile architecture
AMXCOMPLEX // Matrix Multiplication of TF32 Tiles into Packed Single Precision Tile AMXCOMPLEX // Matrix Multiplication of TF32 Tiles into Packed Single Precision Tile
AMXTRANSPOSE // Tile multiply where the first operand is transposed
APX_F // Intel APX APX_F // Intel APX
AVX // AVX functions AVX // AVX functions
AVX10 // If set the Intel AVX10 Converged Vector ISA is supported AVX10 // If set the Intel AVX10 Converged Vector ISA is supported
@@ -222,6 +223,8 @@ const (
SHA // Intel SHA Extensions SHA // Intel SHA Extensions
SME // AMD Secure Memory Encryption supported SME // AMD Secure Memory Encryption supported
SME_COHERENT // AMD Hardware cache coherency across encryption domains enforced SME_COHERENT // AMD Hardware cache coherency across encryption domains enforced
SM3_X86 // SM3 instructions
SM4_X86 // SM4 instructions
SPEC_CTRL_SSBD // Speculative Store Bypass Disable SPEC_CTRL_SSBD // Speculative Store Bypass Disable
SRBDS_CTRL // SRBDS mitigation MSR available SRBDS_CTRL // SRBDS mitigation MSR available
SRSO_MSR_FIX // Indicates that software may use MSR BP_CFG[BpSpecReduce] to mitigate SRSO. SRSO_MSR_FIX // Indicates that software may use MSR BP_CFG[BpSpecReduce] to mitigate SRSO.
@@ -283,7 +286,7 @@ const (
CRC32 // CRC32/CRC32C instructions CRC32 // CRC32/CRC32C instructions
DCPOP // Data cache clean to Point of Persistence (DC CVAP) DCPOP // Data cache clean to Point of Persistence (DC CVAP)
EVTSTRM // Generic timer EVTSTRM // Generic timer
FCMA // Floatin point complex number addition and multiplication FCMA // Floating point complex number addition and multiplication
FHM // FMLAL and FMLSL instructions FHM // FMLAL and FMLSL instructions
FP // Single-precision and double-precision floating point FP // Single-precision and double-precision floating point
FPHP // Half-precision floating point FPHP // Half-precision floating point
@@ -878,7 +881,12 @@ func physicalCores() int {
v, _ := vendorID() v, _ := vendorID()
switch v { switch v {
case Intel: case Intel:
return logicalCores() / threadsPerCore() lc := logicalCores()
tpc := threadsPerCore()
if lc > 0 && tpc > 0 {
return lc / tpc
}
return 0
case AMD, Hygon: case AMD, Hygon:
lc := logicalCores() lc := logicalCores()
tpc := threadsPerCore() tpc := threadsPerCore()
@@ -1279,6 +1287,8 @@ func support() flagSet {
// CPUID.(EAX=7, ECX=1).EAX // CPUID.(EAX=7, ECX=1).EAX
eax1, _, _, edx1 := cpuidex(7, 1) eax1, _, _, edx1 := cpuidex(7, 1)
fs.setIf(fs.inSet(AVX) && eax1&(1<<4) != 0, AVXVNNI) fs.setIf(fs.inSet(AVX) && eax1&(1<<4) != 0, AVXVNNI)
fs.setIf(eax1&(1<<1) != 0, SM3_X86)
fs.setIf(eax1&(1<<2) != 0, SM4_X86)
fs.setIf(eax1&(1<<7) != 0, CMPCCXADD) fs.setIf(eax1&(1<<7) != 0, CMPCCXADD)
fs.setIf(eax1&(1<<10) != 0, MOVSB_ZL) fs.setIf(eax1&(1<<10) != 0, MOVSB_ZL)
fs.setIf(eax1&(1<<11) != 0, STOSB_SHORT) fs.setIf(eax1&(1<<11) != 0, STOSB_SHORT)
@@ -1290,6 +1300,7 @@ func support() flagSet {
// CPUID.(EAX=7, ECX=1).EDX // CPUID.(EAX=7, ECX=1).EDX
fs.setIf(edx1&(1<<4) != 0, AVXVNNIINT8) fs.setIf(edx1&(1<<4) != 0, AVXVNNIINT8)
fs.setIf(edx1&(1<<5) != 0, AVXNECONVERT) fs.setIf(edx1&(1<<5) != 0, AVXNECONVERT)
fs.setIf(edx1&(1<<6) != 0, AMXTRANSPOSE)
fs.setIf(edx1&(1<<7) != 0, AMXTF32) fs.setIf(edx1&(1<<7) != 0, AMXTF32)
fs.setIf(edx1&(1<<8) != 0, AMXCOMPLEX) fs.setIf(edx1&(1<<8) != 0, AMXCOMPLEX)
fs.setIf(edx1&(1<<10) != 0, AVXVNNIINT16) fs.setIf(edx1&(1<<10) != 0, AVXVNNIINT16)
+220 -217
View File
@@ -19,227 +19,230 @@ func _() {
_ = x[AMXTILE-9] _ = x[AMXTILE-9]
_ = x[AMXTF32-10] _ = x[AMXTF32-10]
_ = x[AMXCOMPLEX-11] _ = x[AMXCOMPLEX-11]
_ = x[APX_F-12] _ = x[AMXTRANSPOSE-12]
_ = x[AVX-13] _ = x[APX_F-13]
_ = x[AVX10-14] _ = x[AVX-14]
_ = x[AVX10_128-15] _ = x[AVX10-15]
_ = x[AVX10_256-16] _ = x[AVX10_128-16]
_ = x[AVX10_512-17] _ = x[AVX10_256-17]
_ = x[AVX2-18] _ = x[AVX10_512-18]
_ = x[AVX512BF16-19] _ = x[AVX2-19]
_ = x[AVX512BITALG-20] _ = x[AVX512BF16-20]
_ = x[AVX512BW-21] _ = x[AVX512BITALG-21]
_ = x[AVX512CD-22] _ = x[AVX512BW-22]
_ = x[AVX512DQ-23] _ = x[AVX512CD-23]
_ = x[AVX512ER-24] _ = x[AVX512DQ-24]
_ = x[AVX512F-25] _ = x[AVX512ER-25]
_ = x[AVX512FP16-26] _ = x[AVX512F-26]
_ = x[AVX512IFMA-27] _ = x[AVX512FP16-27]
_ = x[AVX512PF-28] _ = x[AVX512IFMA-28]
_ = x[AVX512VBMI-29] _ = x[AVX512PF-29]
_ = x[AVX512VBMI2-30] _ = x[AVX512VBMI-30]
_ = x[AVX512VL-31] _ = x[AVX512VBMI2-31]
_ = x[AVX512VNNI-32] _ = x[AVX512VL-32]
_ = x[AVX512VP2INTERSECT-33] _ = x[AVX512VNNI-33]
_ = x[AVX512VPOPCNTDQ-34] _ = x[AVX512VP2INTERSECT-34]
_ = x[AVXIFMA-35] _ = x[AVX512VPOPCNTDQ-35]
_ = x[AVXNECONVERT-36] _ = x[AVXIFMA-36]
_ = x[AVXSLOW-37] _ = x[AVXNECONVERT-37]
_ = x[AVXVNNI-38] _ = x[AVXSLOW-38]
_ = x[AVXVNNIINT8-39] _ = x[AVXVNNI-39]
_ = x[AVXVNNIINT16-40] _ = x[AVXVNNIINT8-40]
_ = x[BHI_CTRL-41] _ = x[AVXVNNIINT16-41]
_ = x[BMI1-42] _ = x[BHI_CTRL-42]
_ = x[BMI2-43] _ = x[BMI1-43]
_ = x[CETIBT-44] _ = x[BMI2-44]
_ = x[CETSS-45] _ = x[CETIBT-45]
_ = x[CLDEMOTE-46] _ = x[CETSS-46]
_ = x[CLMUL-47] _ = x[CLDEMOTE-47]
_ = x[CLZERO-48] _ = x[CLMUL-48]
_ = x[CMOV-49] _ = x[CLZERO-49]
_ = x[CMPCCXADD-50] _ = x[CMOV-50]
_ = x[CMPSB_SCADBS_SHORT-51] _ = x[CMPCCXADD-51]
_ = x[CMPXCHG8-52] _ = x[CMPSB_SCADBS_SHORT-52]
_ = x[CPBOOST-53] _ = x[CMPXCHG8-53]
_ = x[CPPC-54] _ = x[CPBOOST-54]
_ = x[CX16-55] _ = x[CPPC-55]
_ = x[EFER_LMSLE_UNS-56] _ = x[CX16-56]
_ = x[ENQCMD-57] _ = x[EFER_LMSLE_UNS-57]
_ = x[ERMS-58] _ = x[ENQCMD-58]
_ = x[F16C-59] _ = x[ERMS-59]
_ = x[FLUSH_L1D-60] _ = x[F16C-60]
_ = x[FMA3-61] _ = x[FLUSH_L1D-61]
_ = x[FMA4-62] _ = x[FMA3-62]
_ = x[FP128-63] _ = x[FMA4-63]
_ = x[FP256-64] _ = x[FP128-64]
_ = x[FSRM-65] _ = x[FP256-65]
_ = x[FXSR-66] _ = x[FSRM-66]
_ = x[FXSROPT-67] _ = x[FXSR-67]
_ = x[GFNI-68] _ = x[FXSROPT-68]
_ = x[HLE-69] _ = x[GFNI-69]
_ = x[HRESET-70] _ = x[HLE-70]
_ = x[HTT-71] _ = x[HRESET-71]
_ = x[HWA-72] _ = x[HTT-72]
_ = x[HYBRID_CPU-73] _ = x[HWA-73]
_ = x[HYPERVISOR-74] _ = x[HYBRID_CPU-74]
_ = x[IA32_ARCH_CAP-75] _ = x[HYPERVISOR-75]
_ = x[IA32_CORE_CAP-76] _ = x[IA32_ARCH_CAP-76]
_ = x[IBPB-77] _ = x[IA32_CORE_CAP-77]
_ = x[IBPB_BRTYPE-78] _ = x[IBPB-78]
_ = x[IBRS-79] _ = x[IBPB_BRTYPE-79]
_ = x[IBRS_PREFERRED-80] _ = x[IBRS-80]
_ = x[IBRS_PROVIDES_SMP-81] _ = x[IBRS_PREFERRED-81]
_ = x[IBS-82] _ = x[IBRS_PROVIDES_SMP-82]
_ = x[IBSBRNTRGT-83] _ = x[IBS-83]
_ = x[IBSFETCHSAM-84] _ = x[IBSBRNTRGT-84]
_ = x[IBSFFV-85] _ = x[IBSFETCHSAM-85]
_ = x[IBSOPCNT-86] _ = x[IBSFFV-86]
_ = x[IBSOPCNTEXT-87] _ = x[IBSOPCNT-87]
_ = x[IBSOPSAM-88] _ = x[IBSOPCNTEXT-88]
_ = x[IBSRDWROPCNT-89] _ = x[IBSOPSAM-89]
_ = x[IBSRIPINVALIDCHK-90] _ = x[IBSRDWROPCNT-90]
_ = x[IBS_FETCH_CTLX-91] _ = x[IBSRIPINVALIDCHK-91]
_ = x[IBS_OPDATA4-92] _ = x[IBS_FETCH_CTLX-92]
_ = x[IBS_OPFUSE-93] _ = x[IBS_OPDATA4-93]
_ = x[IBS_PREVENTHOST-94] _ = x[IBS_OPFUSE-94]
_ = x[IBS_ZEN4-95] _ = x[IBS_PREVENTHOST-95]
_ = x[IDPRED_CTRL-96] _ = x[IBS_ZEN4-96]
_ = x[INT_WBINVD-97] _ = x[IDPRED_CTRL-97]
_ = x[INVLPGB-98] _ = x[INT_WBINVD-98]
_ = x[KEYLOCKER-99] _ = x[INVLPGB-99]
_ = x[KEYLOCKERW-100] _ = x[KEYLOCKER-100]
_ = x[LAHF-101] _ = x[KEYLOCKERW-101]
_ = x[LAM-102] _ = x[LAHF-102]
_ = x[LBRVIRT-103] _ = x[LAM-103]
_ = x[LZCNT-104] _ = x[LBRVIRT-104]
_ = x[MCAOVERFLOW-105] _ = x[LZCNT-105]
_ = x[MCDT_NO-106] _ = x[MCAOVERFLOW-106]
_ = x[MCOMMIT-107] _ = x[MCDT_NO-107]
_ = x[MD_CLEAR-108] _ = x[MCOMMIT-108]
_ = x[MMX-109] _ = x[MD_CLEAR-109]
_ = x[MMXEXT-110] _ = x[MMX-110]
_ = x[MOVBE-111] _ = x[MMXEXT-111]
_ = x[MOVDIR64B-112] _ = x[MOVBE-112]
_ = x[MOVDIRI-113] _ = x[MOVDIR64B-113]
_ = x[MOVSB_ZL-114] _ = x[MOVDIRI-114]
_ = x[MOVU-115] _ = x[MOVSB_ZL-115]
_ = x[MPX-116] _ = x[MOVU-116]
_ = x[MSRIRC-117] _ = x[MPX-117]
_ = x[MSRLIST-118] _ = x[MSRIRC-118]
_ = x[MSR_PAGEFLUSH-119] _ = x[MSRLIST-119]
_ = x[NRIPS-120] _ = x[MSR_PAGEFLUSH-120]
_ = x[NX-121] _ = x[NRIPS-121]
_ = x[OSXSAVE-122] _ = x[NX-122]
_ = x[PCONFIG-123] _ = x[OSXSAVE-123]
_ = x[POPCNT-124] _ = x[PCONFIG-124]
_ = x[PPIN-125] _ = x[POPCNT-125]
_ = x[PREFETCHI-126] _ = x[PPIN-126]
_ = x[PSFD-127] _ = x[PREFETCHI-127]
_ = x[RDPRU-128] _ = x[PSFD-128]
_ = x[RDRAND-129] _ = x[RDPRU-129]
_ = x[RDSEED-130] _ = x[RDRAND-130]
_ = x[RDTSCP-131] _ = x[RDSEED-131]
_ = x[RRSBA_CTRL-132] _ = x[RDTSCP-132]
_ = x[RTM-133] _ = x[RRSBA_CTRL-133]
_ = x[RTM_ALWAYS_ABORT-134] _ = x[RTM-134]
_ = x[SBPB-135] _ = x[RTM_ALWAYS_ABORT-135]
_ = x[SERIALIZE-136] _ = x[SBPB-136]
_ = x[SEV-137] _ = x[SERIALIZE-137]
_ = x[SEV_64BIT-138] _ = x[SEV-138]
_ = x[SEV_ALTERNATIVE-139] _ = x[SEV_64BIT-139]
_ = x[SEV_DEBUGSWAP-140] _ = x[SEV_ALTERNATIVE-140]
_ = x[SEV_ES-141] _ = x[SEV_DEBUGSWAP-141]
_ = x[SEV_RESTRICTED-142] _ = x[SEV_ES-142]
_ = x[SEV_SNP-143] _ = x[SEV_RESTRICTED-143]
_ = x[SGX-144] _ = x[SEV_SNP-144]
_ = x[SGXLC-145] _ = x[SGX-145]
_ = x[SHA-146] _ = x[SGXLC-146]
_ = x[SME-147] _ = x[SHA-147]
_ = x[SME_COHERENT-148] _ = x[SME-148]
_ = x[SPEC_CTRL_SSBD-149] _ = x[SME_COHERENT-149]
_ = x[SRBDS_CTRL-150] _ = x[SM3_X86-150]
_ = x[SRSO_MSR_FIX-151] _ = x[SM4_X86-151]
_ = x[SRSO_NO-152] _ = x[SPEC_CTRL_SSBD-152]
_ = x[SRSO_USER_KERNEL_NO-153] _ = x[SRBDS_CTRL-153]
_ = x[SSE-154] _ = x[SRSO_MSR_FIX-154]
_ = x[SSE2-155] _ = x[SRSO_NO-155]
_ = x[SSE3-156] _ = x[SRSO_USER_KERNEL_NO-156]
_ = x[SSE4-157] _ = x[SSE-157]
_ = x[SSE42-158] _ = x[SSE2-158]
_ = x[SSE4A-159] _ = x[SSE3-159]
_ = x[SSSE3-160] _ = x[SSE4-160]
_ = x[STIBP-161] _ = x[SSE42-161]
_ = x[STIBP_ALWAYSON-162] _ = x[SSE4A-162]
_ = x[STOSB_SHORT-163] _ = x[SSSE3-163]
_ = x[SUCCOR-164] _ = x[STIBP-164]
_ = x[SVM-165] _ = x[STIBP_ALWAYSON-165]
_ = x[SVMDA-166] _ = x[STOSB_SHORT-166]
_ = x[SVMFBASID-167] _ = x[SUCCOR-167]
_ = x[SVML-168] _ = x[SVM-168]
_ = x[SVMNP-169] _ = x[SVMDA-169]
_ = x[SVMPF-170] _ = x[SVMFBASID-170]
_ = x[SVMPFT-171] _ = x[SVML-171]
_ = x[SYSCALL-172] _ = x[SVMNP-172]
_ = x[SYSEE-173] _ = x[SVMPF-173]
_ = x[TBM-174] _ = x[SVMPFT-174]
_ = x[TDX_GUEST-175] _ = x[SYSCALL-175]
_ = x[TLB_FLUSH_NESTED-176] _ = x[SYSEE-176]
_ = x[TME-177] _ = x[TBM-177]
_ = x[TOPEXT-178] _ = x[TDX_GUEST-178]
_ = x[TSCRATEMSR-179] _ = x[TLB_FLUSH_NESTED-179]
_ = x[TSXLDTRK-180] _ = x[TME-180]
_ = x[VAES-181] _ = x[TOPEXT-181]
_ = x[VMCBCLEAN-182] _ = x[TSCRATEMSR-182]
_ = x[VMPL-183] _ = x[TSXLDTRK-183]
_ = x[VMSA_REGPROT-184] _ = x[VAES-184]
_ = x[VMX-185] _ = x[VMCBCLEAN-185]
_ = x[VPCLMULQDQ-186] _ = x[VMPL-186]
_ = x[VTE-187] _ = x[VMSA_REGPROT-187]
_ = x[WAITPKG-188] _ = x[VMX-188]
_ = x[WBNOINVD-189] _ = x[VPCLMULQDQ-189]
_ = x[WRMSRNS-190] _ = x[VTE-190]
_ = x[X87-191] _ = x[WAITPKG-191]
_ = x[XGETBV1-192] _ = x[WBNOINVD-192]
_ = x[XOP-193] _ = x[WRMSRNS-193]
_ = x[XSAVE-194] _ = x[X87-194]
_ = x[XSAVEC-195] _ = x[XGETBV1-195]
_ = x[XSAVEOPT-196] _ = x[XOP-196]
_ = x[XSAVES-197] _ = x[XSAVE-197]
_ = x[AESARM-198] _ = x[XSAVEC-198]
_ = x[ARMCPUID-199] _ = x[XSAVEOPT-199]
_ = x[ASIMD-200] _ = x[XSAVES-200]
_ = x[ASIMDDP-201] _ = x[AESARM-201]
_ = x[ASIMDHP-202] _ = x[ARMCPUID-202]
_ = x[ASIMDRDM-203] _ = x[ASIMD-203]
_ = x[ATOMICS-204] _ = x[ASIMDDP-204]
_ = x[CRC32-205] _ = x[ASIMDHP-205]
_ = x[DCPOP-206] _ = x[ASIMDRDM-206]
_ = x[EVTSTRM-207] _ = x[ATOMICS-207]
_ = x[FCMA-208] _ = x[CRC32-208]
_ = x[FHM-209] _ = x[DCPOP-209]
_ = x[FP-210] _ = x[EVTSTRM-210]
_ = x[FPHP-211] _ = x[FCMA-211]
_ = x[GPA-212] _ = x[FHM-212]
_ = x[JSCVT-213] _ = x[FP-213]
_ = x[LRCPC-214] _ = x[FPHP-214]
_ = x[PMULL-215] _ = x[GPA-215]
_ = x[RNDR-216] _ = x[JSCVT-216]
_ = x[TLB-217] _ = x[LRCPC-217]
_ = x[TS-218] _ = x[PMULL-218]
_ = x[SHA1-219] _ = x[RNDR-219]
_ = x[SHA2-220] _ = x[TLB-220]
_ = x[SHA3-221] _ = x[TS-221]
_ = x[SHA512-222] _ = x[SHA1-222]
_ = x[SM3-223] _ = x[SHA2-223]
_ = x[SM4-224] _ = x[SHA3-224]
_ = x[SVE-225] _ = x[SHA512-225]
_ = x[lastID-226] _ = x[SM3-226]
_ = x[SM4-227]
_ = x[SVE-228]
_ = x[lastID-229]
_ = x[firstID-0] _ = x[firstID-0]
} }
const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXFP8AMXTILEAMXTF32AMXCOMPLEXAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8AVXVNNIINT16BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSHASMESME_COHERENTSPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFHMFPFPHPGPAJSCVTLRCPCPMULLRNDRTLBTSSHA1SHA2SHA3SHA512SM3SM4SVElastID" const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXFP16AMXINT8AMXFP8AMXTILEAMXTF32AMXCOMPLEXAMXTRANSPOSEAPX_FAVXAVX10AVX10_128AVX10_256AVX10_512AVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXIFMAAVXNECONVERTAVXSLOWAVXVNNIAVXVNNIINT8AVXVNNIINT16BHI_CTRLBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPCCXADDCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCPPCCX16EFER_LMSLE_UNSENQCMDERMSF16CFLUSH_L1DFMA3FMA4FP128FP256FSRMFXSRFXSROPTGFNIHLEHRESETHTTHWAHYBRID_CPUHYPERVISORIA32_ARCH_CAPIA32_CORE_CAPIBPBIBPB_BRTYPEIBRSIBRS_PREFERREDIBRS_PROVIDES_SMPIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_FETCH_CTLXIBS_OPDATA4IBS_OPFUSEIBS_PREVENTHOSTIBS_ZEN4IDPRED_CTRLINT_WBINVDINVLPGBKEYLOCKERKEYLOCKERWLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCDT_NOMCOMMITMD_CLEARMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMOVUMPXMSRIRCMSRLISTMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTPPINPREFETCHIPSFDRDPRURDRANDRDSEEDRDTSCPRRSBA_CTRLRTMRTM_ALWAYS_ABORTSBPBSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSHASMESME_COHERENTSM3_X86SM4_X86SPEC_CTRL_SSBDSRBDS_CTRLSRSO_MSR_FIXSRSO_NOSRSO_USER_KERNEL_NOSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTIBP_ALWAYSONSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTDX_GUESTTLB_FLUSH_NESTEDTMETOPEXTTSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDWRMSRNSX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFHMFPFPHPGPAJSCVTLRCPCPMULLRNDRTLBTSSHA1SHA2SHA3SHA512SM3SM4SVElastID"
var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 61, 68, 75, 85, 90, 93, 98, 107, 116, 125, 129, 139, 151, 159, 167, 175, 183, 190, 200, 210, 218, 228, 239, 247, 257, 275, 290, 297, 309, 316, 323, 334, 346, 354, 358, 362, 368, 373, 381, 386, 392, 396, 405, 423, 431, 438, 442, 446, 460, 466, 470, 474, 483, 487, 491, 496, 501, 505, 509, 516, 520, 523, 529, 532, 535, 545, 555, 568, 581, 585, 596, 600, 614, 631, 634, 644, 655, 661, 669, 680, 688, 700, 716, 730, 741, 751, 766, 774, 785, 795, 802, 811, 821, 825, 828, 835, 840, 851, 858, 865, 873, 876, 882, 887, 896, 903, 911, 915, 918, 924, 931, 944, 949, 951, 958, 965, 971, 975, 984, 988, 993, 999, 1005, 1011, 1021, 1024, 1040, 1044, 1053, 1056, 1065, 1080, 1093, 1099, 1113, 1120, 1123, 1128, 1131, 1134, 1146, 1160, 1170, 1182, 1189, 1208, 1211, 1215, 1219, 1223, 1228, 1233, 1238, 1243, 1257, 1268, 1274, 1277, 1282, 1291, 1295, 1300, 1305, 1311, 1318, 1323, 1326, 1335, 1351, 1354, 1360, 1370, 1378, 1382, 1391, 1395, 1407, 1410, 1420, 1423, 1430, 1438, 1445, 1448, 1455, 1458, 1463, 1469, 1477, 1483, 1489, 1497, 1502, 1509, 1516, 1524, 1531, 1536, 1541, 1548, 1552, 1555, 1557, 1561, 1564, 1569, 1574, 1579, 1583, 1586, 1588, 1592, 1596, 1600, 1606, 1609, 1612, 1615, 1621} var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 61, 68, 75, 85, 97, 102, 105, 110, 119, 128, 137, 141, 151, 163, 171, 179, 187, 195, 202, 212, 222, 230, 240, 251, 259, 269, 287, 302, 309, 321, 328, 335, 346, 358, 366, 370, 374, 380, 385, 393, 398, 404, 408, 417, 435, 443, 450, 454, 458, 472, 478, 482, 486, 495, 499, 503, 508, 513, 517, 521, 528, 532, 535, 541, 544, 547, 557, 567, 580, 593, 597, 608, 612, 626, 643, 646, 656, 667, 673, 681, 692, 700, 712, 728, 742, 753, 763, 778, 786, 797, 807, 814, 823, 833, 837, 840, 847, 852, 863, 870, 877, 885, 888, 894, 899, 908, 915, 923, 927, 930, 936, 943, 956, 961, 963, 970, 977, 983, 987, 996, 1000, 1005, 1011, 1017, 1023, 1033, 1036, 1052, 1056, 1065, 1068, 1077, 1092, 1105, 1111, 1125, 1132, 1135, 1140, 1143, 1146, 1158, 1165, 1172, 1186, 1196, 1208, 1215, 1234, 1237, 1241, 1245, 1249, 1254, 1259, 1264, 1269, 1283, 1294, 1300, 1303, 1308, 1317, 1321, 1326, 1331, 1337, 1344, 1349, 1352, 1361, 1377, 1380, 1386, 1396, 1404, 1408, 1417, 1421, 1433, 1436, 1446, 1449, 1456, 1464, 1471, 1474, 1481, 1484, 1489, 1495, 1503, 1509, 1515, 1523, 1528, 1535, 1542, 1550, 1557, 1562, 1567, 1574, 1578, 1581, 1583, 1587, 1590, 1595, 1600, 1605, 1609, 1612, 1614, 1618, 1622, 1626, 1632, 1635, 1638, 1641, 1647}
func (i FeatureID) String() string { func (i FeatureID) String() string {
if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) { if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) {
+41 -39
View File
@@ -65,9 +65,16 @@ func sysctlGetInt64(unknown int, names ...string) int {
return unknown return unknown
} }
func setFeature(c *CPUInfo, name string, feature FeatureID) { func setFeature(c *CPUInfo, feature FeatureID, aliases ...string) {
c.featureSet.setIf(sysctlGetBool(name), feature) for _, alias := range aliases {
set := sysctlGetBool(alias)
c.featureSet.setIf(set, feature)
if set {
break
}
}
} }
func tryToFillCPUInfoFomSysctl(c *CPUInfo) { func tryToFillCPUInfoFomSysctl(c *CPUInfo) {
c.BrandName = sysctlGetString("machdep.cpu.brand_string") c.BrandName = sysctlGetString("machdep.cpu.brand_string")
@@ -87,41 +94,36 @@ func tryToFillCPUInfoFomSysctl(c *CPUInfo) {
c.Cache.L2 = sysctlGetInt64(-1, "hw.l2cachesize") c.Cache.L2 = sysctlGetInt64(-1, "hw.l2cachesize")
c.Cache.L3 = sysctlGetInt64(-1, "hw.l3cachesize") c.Cache.L3 = sysctlGetInt64(-1, "hw.l3cachesize")
// from https://developer.arm.com/downloads/-/exploration-tools/feature-names-for-a-profile // ARM features:
setFeature(c, "hw.optional.arm.FEAT_AES", AESARM) //
setFeature(c, "hw.optional.AdvSIMD", ASIMD) // Note: On some Apple Silicon system, some feats have aliases. See:
setFeature(c, "hw.optional.arm.FEAT_DotProd", ASIMDDP) // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics
setFeature(c, "hw.optional.arm.FEAT_RDM", ASIMDRDM) // When so, we look at all aliases and consider a feature available when at least one identifier matches.
setFeature(c, "hw.optional.FEAT_CRC32", CRC32) setFeature(c, AESARM, "hw.optional.arm.FEAT_AES") // AES instructions
setFeature(c, "hw.optional.arm.FEAT_DPB", DCPOP) setFeature(c, ASIMD, "hw.optional.arm.AdvSIMD", "hw.optional.neon") // Advanced SIMD
// setFeature(c, "", EVTSTRM) setFeature(c, ASIMDDP, "hw.optional.arm.FEAT_DotProd") // SIMD Dot Product
setFeature(c, "hw.optional.arm.FEAT_FCMA", FCMA) setFeature(c, ASIMDHP, "hw.optional.arm.AdvSIMD_HPFPCvt", "hw.optional.neon_hpfp") // Advanced SIMD half-precision floating point
setFeature(c, "hw.optional.arm.FEAT_FHM", FHM) setFeature(c, ASIMDRDM, "hw.optional.arm.FEAT_RDM") // Rounding Double Multiply Accumulate/Subtract
setFeature(c, "hw.optional.arm.FEAT_FP", FP) setFeature(c, ATOMICS, "hw.optional.arm.FEAT_LSE", "hw.optional.armv8_1_atomics") // Large System Extensions (LSE)
setFeature(c, "hw.optional.arm.FEAT_FP16", FPHP) setFeature(c, CRC32, "hw.optional.arm.FEAT_CRC32", "hw.optional.armv8_crc32") // CRC32/CRC32C instructions
setFeature(c, "hw.optional.arm.FEAT_PAuth", GPA) setFeature(c, DCPOP, "hw.optional.arm.FEAT_DPB") // Data cache clean to Point of Persistence (DC CVAP)
setFeature(c, "hw.optional.arm.FEAT_RNG", RNDR) setFeature(c, EVTSTRM, "hw.optional.arm.FEAT_ECV") // Generic timer
setFeature(c, "hw.optional.arm.FEAT_JSCVT", JSCVT) setFeature(c, FCMA, "hw.optional.arm.FEAT_FCMA", "hw.optional.armv8_3_compnum") // Floating point complex number addition and multiplication
setFeature(c, "hw.optional.arm.FEAT_LRCPC", LRCPC) setFeature(c, FHM, "hw.optional.armv8_2_fhm", "hw.optional.arm.FEAT_FHM") // FMLAL and FMLSL instructions
setFeature(c, "hw.optional.arm.FEAT_PMULL", PMULL) setFeature(c, FP, "hw.optional.floatingpoint") // Single-precision and double-precision floating point
setFeature(c, "hw.optional.arm.FEAT_SHA1", SHA1) setFeature(c, FPHP, "hw.optional.arm.FEAT_FP16", "hw.optional.neon_fp16") // Half-precision floating point
setFeature(c, "hw.optional.arm.FEAT_SHA256", SHA2) setFeature(c, GPA, "hw.optional.arm.FEAT_PAuth") // Generic Pointer Authentication
setFeature(c, "hw.optional.arm.FEAT_SHA3", SHA3) setFeature(c, JSCVT, "hw.optional.arm.FEAT_JSCVT") // Javascript-style double->int convert (FJCVTZS)
setFeature(c, "hw.optional.arm.FEAT_SHA512", SHA512) setFeature(c, LRCPC, "hw.optional.arm.FEAT_LRCPC") // Weaker release consistency (LDAPR, etc)
setFeature(c, "hw.optional.arm.FEAT_TLBIOS", TLB) setFeature(c, PMULL, "hw.optional.arm.FEAT_PMULL") // Polynomial Multiply instructions (PMULL/PMULL2)
setFeature(c, "hw.optional.arm.FEAT_TLBIRANGE", TLB) setFeature(c, RNDR, "hw.optional.arm.FEAT_RNG") // Random Number instructions
setFeature(c, "hw.optional.arm.FEAT_FlagM", TS) setFeature(c, TLB, "hw.optional.arm.FEAT_TLBIOS", "hw.optional.arm.FEAT_TLBIRANGE") // Outer Shareable and TLB range maintenance instructions
setFeature(c, "hw.optional.arm.FEAT_FlagM2", TS) setFeature(c, TS, "hw.optional.arm.FEAT_FlagM", "hw.optional.arm.FEAT_FlagM2") // Flag manipulation instructions
// setFeature(c, "", SM3) setFeature(c, SHA1, "hw.optional.arm.FEAT_SHA1") // SHA-1 instructions (SHA1C, etc)
// setFeature(c, "", SM4) setFeature(c, SHA2, "hw.optional.arm.FEAT_SHA256") // SHA-2 instructions (SHA256H, etc)
setFeature(c, "hw.optional.arm.FEAT_SVE", SVE) setFeature(c, SHA3, "hw.optional.arm.FEAT_SHA3") // SHA-3 instructions (EOR3, RAXI, XAR, BCAX)
setFeature(c, SHA512, "hw.optional.arm.FEAT_SHA512") // SHA512 instructions
// from empirical observation setFeature(c, SM3, "hw.optional.arm.FEAT_SM3") // SM3 instructions
setFeature(c, "hw.optional.AdvSIMD_HPFPCvt", ASIMDHP) setFeature(c, SM4, "hw.optional.arm.FEAT_SM4") // SM4 instructions
setFeature(c, "hw.optional.armv8_1_atomics", ATOMICS) setFeature(c, SVE, "hw.optional.arm.FEAT_SVE") // Scalable Vector Extension
setFeature(c, "hw.optional.floatingpoint", FP)
setFeature(c, "hw.optional.armv8_2_sha3", SHA3)
setFeature(c, "hw.optional.armv8_2_sha512", SHA512)
setFeature(c, "hw.optional.armv8_3_compnum", FCMA)
setFeature(c, "hw.optional.armv8_crc32", CRC32)
} }
+1 -1
View File
@@ -10,6 +10,6 @@ import (
"github.com/klauspost/cpuid/v2" "github.com/klauspost/cpuid/v2"
) )
var hasAsm = cpuid.CPU.Supports(cpuid.ASIMD) && cpuid.CPU.Supports(cpuid.PMULL) var hasAsm = cpuid.CPU.Supports(cpuid.ASIMD, cpuid.PMULL, cpuid.SHA3)
func updateAsm(crc uint64, p []byte) (checksum uint64) func updateAsm(crc uint64, p []byte) (checksum uint64)
+6 -2
View File
@@ -127,6 +127,10 @@ func (c *Client) appendObjectDo(ctx context.Context, bucketName, objectName stri
if opts.checksumType.IsSet() { if opts.checksumType.IsSet() {
reqMetadata.addCrc = &opts.checksumType reqMetadata.addCrc = &opts.checksumType
reqMetadata.customHeader.Set(amzChecksumAlgo, opts.checksumType.String())
if opts.checksumType.FullObjectRequested() {
reqMetadata.customHeader.Set(amzChecksumMode, ChecksumFullObjectMode.String())
}
} }
// Execute PUT an objectName. // Execute PUT an objectName.
@@ -183,8 +187,8 @@ func (c *Client) AppendObject(ctx context.Context, bucketName, objectName string
if err != nil { if err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
if oinfo.ChecksumMode != ChecksumFullObjectMode.String() { if oinfo.ChecksumMode != "" && oinfo.ChecksumMode != ChecksumFullObjectMode.String() {
return UploadInfo{}, fmt.Errorf("append API is not allowed on objects that are not full_object checksum type: %s", oinfo.ChecksumMode) return UploadInfo{}, fmt.Errorf("Append() is not allowed on objects that are not of FULL_OBJECT checksum type: %s", oinfo.ChecksumMode)
} }
opts.setChecksumParams(oinfo) // set the appropriate checksum params based on the existing object checksum metadata. opts.setChecksumParams(oinfo) // set the appropriate checksum params based on the existing object checksum metadata.
opts.setWriteOffset(oinfo.Size) // First append must set the current object size as the offset. opts.setWriteOffset(oinfo.Size) // First append must set the current object size as the offset.
+5 -5
View File
@@ -82,16 +82,12 @@ func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, obj
// avoid sha256 with non-v4 signature request or // avoid sha256 with non-v4 signature request or
// HTTPS connection. // HTTPS connection.
hashAlgos, hashSums := c.hashMaterials(opts.SendContentMd5, !opts.DisableContentSha256) hashAlgos, hashSums := c.hashMaterials(opts.SendContentMd5, !opts.DisableContentSha256)
if len(hashSums) == 0 {
addAutoChecksumHeaders(&opts)
}
// Initiate a new multipart upload. // Initiate a new multipart upload.
uploadID, err := c.newUploadID(ctx, bucketName, objectName, opts) uploadID, err := c.newUploadID(ctx, bucketName, objectName, opts)
if err != nil { if err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
delete(opts.UserMetadata, "X-Amz-Checksum-Algorithm")
defer func() { defer func() {
if err != nil { if err != nil {
@@ -145,11 +141,15 @@ func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, obj
if hashSums["sha256"] != nil { if hashSums["sha256"] != nil {
sha256Hex = hex.EncodeToString(hashSums["sha256"]) sha256Hex = hex.EncodeToString(hashSums["sha256"])
} }
if len(hashSums) == 0 { if opts.AutoChecksum.IsSet() {
crc.Reset() crc.Reset()
crc.Write(buf[:length]) crc.Write(buf[:length])
cSum := crc.Sum(nil) cSum := crc.Sum(nil)
customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum)) customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum))
customHeader.Set(amzChecksumAlgo, opts.AutoChecksum.String())
if opts.AutoChecksum.FullObjectRequested() {
customHeader.Set(amzChecksumMode, ChecksumFullObjectMode.String())
}
} }
p := uploadPartParams{bucketName: bucketName, objectName: objectName, uploadID: uploadID, reader: rd, partNumber: partNumber, md5Base64: md5Base64, sha256Hex: sha256Hex, size: int64(length), sse: opts.ServerSideEncryption, streamSha256: !opts.DisableContentSha256, customHeader: customHeader} p := uploadPartParams{bucketName: bucketName, objectName: objectName, uploadID: uploadID, reader: rd, partNumber: partNumber, md5Base64: md5Base64, sha256Hex: sha256Hex, size: int64(length), sse: opts.ServerSideEncryption, streamSha256: !opts.DisableContentSha256, customHeader: customHeader}
+26 -42
View File
@@ -108,19 +108,14 @@ func (c *Client) putObjectMultipartStreamFromReadAt(ctx context.Context, bucketN
if err != nil { if err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
if opts.Checksum.IsSet() {
opts.AutoChecksum = opts.Checksum
}
withChecksum := c.trailingHeaderSupport
if withChecksum {
addAutoChecksumHeaders(&opts)
}
// Initiate a new multipart upload. // Initiate a new multipart upload.
uploadID, err := c.newUploadID(ctx, bucketName, objectName, opts) uploadID, err := c.newUploadID(ctx, bucketName, objectName, opts)
if err != nil { if err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
delete(opts.UserMetadata, "X-Amz-Checksum-Algorithm")
withChecksum := c.trailingHeaderSupport
// Aborts the multipart upload in progress, if the // Aborts the multipart upload in progress, if the
// function returns any error, since we do not resume // function returns any error, since we do not resume
@@ -297,15 +292,6 @@ func (c *Client) putObjectMultipartStreamOptionalChecksum(ctx context.Context, b
return UploadInfo{}, err return UploadInfo{}, err
} }
if opts.Checksum.IsSet() {
opts.AutoChecksum = opts.Checksum
opts.SendContentMd5 = false
}
if !opts.SendContentMd5 {
addAutoChecksumHeaders(&opts)
}
// Calculate the optimal parts info for a given size. // Calculate the optimal parts info for a given size.
totalPartsCount, partSize, lastPartSize, err := OptimalPartInfo(size, opts.PartSize) totalPartsCount, partSize, lastPartSize, err := OptimalPartInfo(size, opts.PartSize)
if err != nil { if err != nil {
@@ -316,7 +302,6 @@ func (c *Client) putObjectMultipartStreamOptionalChecksum(ctx context.Context, b
if err != nil { if err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
delete(opts.UserMetadata, "X-Amz-Checksum-Algorithm")
// Aborts the multipart upload if the function returns // Aborts the multipart upload if the function returns
// any error, since we do not resume we should purge // any error, since we do not resume we should purge
@@ -369,12 +354,18 @@ func (c *Client) putObjectMultipartStreamOptionalChecksum(ctx context.Context, b
md5Hash.Reset() md5Hash.Reset()
md5Hash.Write(buf[:length]) md5Hash.Write(buf[:length])
md5Base64 = base64.StdEncoding.EncodeToString(md5Hash.Sum(nil)) md5Base64 = base64.StdEncoding.EncodeToString(md5Hash.Sum(nil))
} else { }
if opts.AutoChecksum.IsSet() {
// Add CRC32C instead. // Add CRC32C instead.
crc.Reset() crc.Reset()
crc.Write(buf[:length]) crc.Write(buf[:length])
cSum := crc.Sum(nil) cSum := crc.Sum(nil)
customHeader.Set(opts.AutoChecksum.KeyCapitalized(), base64.StdEncoding.EncodeToString(cSum)) customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum))
customHeader.Set(amzChecksumAlgo, opts.AutoChecksum.String())
if opts.AutoChecksum.FullObjectRequested() {
customHeader.Set(amzChecksumMode, ChecksumFullObjectMode.String())
}
} }
// Update progress reader appropriately to the latest offset // Update progress reader appropriately to the latest offset
@@ -453,13 +444,6 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam
if err = s3utils.CheckValidObjectName(objectName); err != nil { if err = s3utils.CheckValidObjectName(objectName); err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
if opts.Checksum.IsSet() {
opts.SendContentMd5 = false
opts.AutoChecksum = opts.Checksum
}
if !opts.SendContentMd5 {
addAutoChecksumHeaders(&opts)
}
// Cancel all when an error occurs. // Cancel all when an error occurs.
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
@@ -476,7 +460,6 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam
if err != nil { if err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
delete(opts.UserMetadata, "X-Amz-Checksum-Algorithm")
// Aborts the multipart upload if the function returns // Aborts the multipart upload if the function returns
// any error, since we do not resume we should purge // any error, since we do not resume we should purge
@@ -541,18 +524,22 @@ func (c *Client) putObjectMultipartStreamParallel(ctx context.Context, bucketNam
return UploadInfo{}, rerr return UploadInfo{}, rerr
} }
// Calculate md5sum.
customHeader := make(http.Header)
if !opts.SendContentMd5 {
// Add Checksum instead.
crc.Reset()
crc.Write(buf[:length])
cSum := crc.Sum(nil)
customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum))
}
wg.Add(1) wg.Add(1)
go func(partNumber int) { go func(partNumber int) {
// Calculate md5sum.
customHeader := make(http.Header)
if opts.AutoChecksum.IsSet() {
// Add Checksum instead.
crc.Reset()
crc.Write(buf[:length])
cSum := crc.Sum(nil)
customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum))
customHeader.Set(amzChecksumAlgo, opts.AutoChecksum.String())
if opts.AutoChecksum.FullObjectRequested() {
customHeader.Set(amzChecksumMode, ChecksumFullObjectMode.String())
}
}
// Avoid declaring variables in the for loop // Avoid declaring variables in the for loop
var md5Base64 string var md5Base64 string
@@ -664,9 +651,6 @@ func (c *Client) putObject(ctx context.Context, bucketName, objectName string, r
if opts.SendContentMd5 && s3utils.IsGoogleEndpoint(*c.endpointURL) && size < 0 { if opts.SendContentMd5 && s3utils.IsGoogleEndpoint(*c.endpointURL) && size < 0 {
return UploadInfo{}, errInvalidArgument("MD5Sum cannot be calculated with size '-1'") return UploadInfo{}, errInvalidArgument("MD5Sum cannot be calculated with size '-1'")
} }
if opts.Checksum.IsSet() {
opts.SendContentMd5 = false
}
var readSeeker io.Seeker var readSeeker io.Seeker
if size > 0 { if size > 0 {
@@ -759,7 +743,7 @@ func (c *Client) putObjectDo(ctx context.Context, bucketName, objectName string,
} }
} }
if addCrc { if addCrc {
opts.AutoChecksum.SetDefault(ChecksumCRC32C) opts.AutoChecksum.SetDefault(ChecksumFullObjectCRC32C)
reqMetadata.addCrc = &opts.AutoChecksum reqMetadata.addCrc = &opts.AutoChecksum
} }
} }
+30 -18
View File
@@ -26,6 +26,7 @@ import (
"io" "io"
"net/http" "net/http"
"sort" "sort"
"strings"
"time" "time"
"github.com/minio/minio-go/v7/pkg/encrypt" "github.com/minio/minio-go/v7/pkg/encrypt"
@@ -267,7 +268,16 @@ func (opts PutObjectOptions) validate(c *Client) (err error) {
if opts.LegalHold != "" && !opts.LegalHold.IsValid() { if opts.LegalHold != "" && !opts.LegalHold.IsValid() {
return errInvalidArgument(opts.LegalHold.String() + " unsupported legal-hold status") return errInvalidArgument(opts.LegalHold.String() + " unsupported legal-hold status")
} }
if opts.Checksum.IsSet() {
checkCrc := false
for k := range opts.UserMetadata {
if strings.HasPrefix(k, "x-amz-checksum-") {
checkCrc = true
break
}
}
if opts.Checksum.IsSet() || checkCrc {
switch { switch {
case !c.trailingHeaderSupport: case !c.trailingHeaderSupport:
return errInvalidArgument("Checksum requires Client with TrailingHeaders enabled") return errInvalidArgument("Checksum requires Client with TrailingHeaders enabled")
@@ -307,10 +317,10 @@ func (a completedParts) Less(i, j int) bool { return a[i].PartNumber < a[j].Part
// be reused for best outcomes for PutObject(), pass the size always. // be reused for best outcomes for PutObject(), pass the size always.
// //
// NOTE: Upon errors during upload multipart operation is entirely aborted. // NOTE: Upon errors during upload multipart operation is entirely aborted.
func (c *Client) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, func (c *Client) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64,
opts PutObjectOptions, opts PutObjectOptions,
) (info UploadInfo, err error) { ) (info UploadInfo, err error) {
if objectSize < 0 && opts.DisableMultipart { if size < 0 && opts.DisableMultipart {
return UploadInfo{}, errors.New("object size must be provided with disable multipart upload") return UploadInfo{}, errors.New("object size must be provided with disable multipart upload")
} }
@@ -319,15 +329,20 @@ func (c *Client) PutObject(ctx context.Context, bucketName, objectName string, r
return UploadInfo{}, err return UploadInfo{}, err
} }
return c.putObjectCommon(ctx, bucketName, objectName, reader, objectSize, opts)
}
func (c *Client) putObjectCommon(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, opts PutObjectOptions) (info UploadInfo, err error) {
// Check for largest object size allowed. // Check for largest object size allowed.
if size > int64(maxMultipartPutObjectSize) { if size > int64(maxMultipartPutObjectSize) {
return UploadInfo{}, errEntityTooLarge(size, maxMultipartPutObjectSize, bucketName, objectName) return UploadInfo{}, errEntityTooLarge(size, maxMultipartPutObjectSize, bucketName, objectName)
} }
opts.AutoChecksum.SetDefault(ChecksumCRC32C)
if opts.Checksum.IsSet() {
opts.AutoChecksum = opts.Checksum
opts.SendContentMd5 = false
}
if c.trailingHeaderSupport {
opts.AutoChecksum.SetDefault(ChecksumCRC32C)
addAutoChecksumHeaders(&opts)
}
// NOTE: Streaming signature is not supported by GCS. // NOTE: Streaming signature is not supported by GCS.
if s3utils.IsGoogleEndpoint(*c.endpointURL) { if s3utils.IsGoogleEndpoint(*c.endpointURL) {
@@ -385,20 +400,11 @@ func (c *Client) putObjectMultipartStreamNoLength(ctx context.Context, bucketNam
return UploadInfo{}, err return UploadInfo{}, err
} }
if opts.Checksum.IsSet() {
opts.SendContentMd5 = false
opts.AutoChecksum = opts.Checksum
}
if !opts.SendContentMd5 {
addAutoChecksumHeaders(&opts)
}
// Initiate a new multipart upload. // Initiate a new multipart upload.
uploadID, err := c.newUploadID(ctx, bucketName, objectName, opts) uploadID, err := c.newUploadID(ctx, bucketName, objectName, opts)
if err != nil { if err != nil {
return UploadInfo{}, err return UploadInfo{}, err
} }
delete(opts.UserMetadata, "X-Amz-Checksum-Algorithm")
defer func() { defer func() {
if err != nil { if err != nil {
@@ -437,11 +443,17 @@ func (c *Client) putObjectMultipartStreamNoLength(ctx context.Context, bucketNam
hash.Write(buf[:length]) hash.Write(buf[:length])
md5Base64 = base64.StdEncoding.EncodeToString(hash.Sum(nil)) md5Base64 = base64.StdEncoding.EncodeToString(hash.Sum(nil))
hash.Close() hash.Close()
} else { }
if opts.AutoChecksum.IsSet() {
crc.Reset() crc.Reset()
crc.Write(buf[:length]) crc.Write(buf[:length])
cSum := crc.Sum(nil) cSum := crc.Sum(nil)
customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum)) customHeader.Set(opts.AutoChecksum.Key(), base64.StdEncoding.EncodeToString(cSum))
customHeader.Set(amzChecksumAlgo, opts.AutoChecksum.String())
if opts.AutoChecksum.FullObjectRequested() {
customHeader.Set(amzChecksumMode, ChecksumFullObjectMode.String())
}
} }
// Update progress reader appropriately to the latest offset // Update progress reader appropriately to the latest offset
+3 -4
View File
@@ -43,12 +43,11 @@ import (
md5simd "github.com/minio/md5-simd" md5simd "github.com/minio/md5-simd"
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio-go/v7/pkg/kvcache" "github.com/minio/minio-go/v7/pkg/kvcache"
"github.com/minio/minio-go/v7/pkg/peeker"
"github.com/minio/minio-go/v7/pkg/s3utils" "github.com/minio/minio-go/v7/pkg/s3utils"
"github.com/minio/minio-go/v7/pkg/signer" "github.com/minio/minio-go/v7/pkg/signer"
"github.com/minio/minio-go/v7/pkg/singleflight" "github.com/minio/minio-go/v7/pkg/singleflight"
"golang.org/x/net/publicsuffix" "golang.org/x/net/publicsuffix"
internalutils "github.com/minio/minio-go/v7/pkg/utils"
) )
// Client implements Amazon S3 compatible methods. // Client implements Amazon S3 compatible methods.
@@ -163,7 +162,7 @@ type Options struct {
// Global constants. // Global constants.
const ( const (
libraryName = "minio-go" libraryName = "minio-go"
libraryVersion = "v7.0.94" libraryVersion = "v7.0.95"
) )
// User Agent should always following the below style. // User Agent should always following the below style.
@@ -625,7 +624,7 @@ func (c *Client) do(req *http.Request) (resp *http.Response, err error) {
// - Return the error XML bytes if an error is found // - Return the error XML bytes if an error is found
// - Make sure to always restablish the whole http response stream before returning // - Make sure to always restablish the whole http response stream before returning
func tryParseErrRespFromBody(resp *http.Response) ([]byte, error) { func tryParseErrRespFromBody(resp *http.Response) ([]byte, error) {
peeker := internalutils.NewPeekReadCloser(resp.Body, 5*humanize.MiByte) peeker := peeker.NewPeekReadCloser(resp.Body, 5*humanize.MiByte)
defer func() { defer func() {
peeker.ReplayFromStart() peeker.ReplayFromStart()
resp.Body = peeker resp.Body = peeker
+20 -6
View File
@@ -29,6 +29,7 @@ import (
"math/bits" "math/bits"
"net/http" "net/http"
"sort" "sort"
"strings"
"github.com/minio/crc64nvme" "github.com/minio/crc64nvme"
) )
@@ -432,9 +433,19 @@ func addAutoChecksumHeaders(opts *PutObjectOptions) {
if opts.UserMetadata == nil { if opts.UserMetadata == nil {
opts.UserMetadata = make(map[string]string, 1) opts.UserMetadata = make(map[string]string, 1)
} }
opts.UserMetadata["X-Amz-Checksum-Algorithm"] = opts.AutoChecksum.String()
if opts.AutoChecksum.FullObjectRequested() { addChecksum := true
opts.UserMetadata[amzChecksumMode] = ChecksumFullObjectMode.String() for k := range opts.UserMetadata {
if strings.HasPrefix(strings.ToLower(k), "x-amz-checksum-") {
addChecksum = false
}
}
if addChecksum && opts.AutoChecksum.IsSet() {
opts.UserMetadata[amzChecksumAlgo] = opts.AutoChecksum.String()
if opts.AutoChecksum.FullObjectRequested() {
opts.UserMetadata[amzChecksumMode] = ChecksumFullObjectMode.String()
}
} }
} }
@@ -446,14 +457,17 @@ func applyAutoChecksum(opts *PutObjectOptions, allParts []ObjectPart) {
// Add composite hash of hashes. // Add composite hash of hashes.
crc, err := opts.AutoChecksum.CompositeChecksum(allParts) crc, err := opts.AutoChecksum.CompositeChecksum(allParts)
if err == nil { if err == nil {
opts.UserMetadata = map[string]string{opts.AutoChecksum.Key(): crc.Encoded()} opts.UserMetadata = map[string]string{
opts.AutoChecksum.Key(): crc.Encoded(),
amzChecksumMode: ChecksumCompositeMode.String(),
}
} }
} else if opts.AutoChecksum.CanMergeCRC() { } else if opts.AutoChecksum.CanMergeCRC() {
crc, err := opts.AutoChecksum.FullObjectChecksum(allParts) crc, err := opts.AutoChecksum.FullObjectChecksum(allParts)
if err == nil { if err == nil {
opts.UserMetadata = map[string]string{ opts.UserMetadata = map[string]string{
opts.AutoChecksum.KeyCapitalized(): crc.Encoded(), opts.AutoChecksum.Key(): crc.Encoded(),
amzChecksumMode: ChecksumFullObjectMode.String(), amzChecksumMode: ChecksumFullObjectMode.String(),
} }
} }
} }
+192 -23
View File
@@ -1970,7 +1970,7 @@ func testPutObjectWithChecksums() {
// initialize logging params // initialize logging params
startTime := time.Now() startTime := time.Now()
testName := getFuncName() testName := getFuncName()
function := "PutObject(bucketName, objectName, reader,size, opts)" function := "PutObject(bucketName, objectName, reader, size, opts)"
args := map[string]interface{}{ args := map[string]interface{}{
"bucketName": "", "bucketName": "",
"objectName": "", "objectName": "",
@@ -1982,7 +1982,7 @@ func testPutObjectWithChecksums() {
return return
} }
c, err := NewClient(ClientConfig{}) c, err := NewClient(ClientConfig{TrailingHeaders: true})
if err != nil { if err != nil {
logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
return return
@@ -2037,6 +2037,10 @@ func testPutObjectWithChecksums() {
h := test.cs.Hasher() h := test.cs.Hasher()
h.Reset() h.Reset()
if test.cs.IsSet() {
meta["x-amz-checksum-algorithm"] = test.cs.String()
}
// Test with a bad CRC - we haven't called h.Write(b), so this is a checksum of empty data // Test with a bad CRC - we haven't called h.Write(b), so this is a checksum of empty data
meta[test.cs.Key()] = base64.StdEncoding.EncodeToString(h.Sum(nil)) meta[test.cs.Key()] = base64.StdEncoding.EncodeToString(h.Sum(nil))
args["metadata"] = meta args["metadata"] = meta
@@ -2323,7 +2327,7 @@ func testPutObjectWithTrailingChecksums() {
} }
// Test PutObject with custom checksums. // Test PutObject with custom checksums.
func testPutMultipartObjectWithChecksums(trailing bool) { func testPutMultipartObjectWithChecksums() {
// initialize logging params // initialize logging params
startTime := time.Now() startTime := time.Now()
testName := getFuncName() testName := getFuncName()
@@ -2331,7 +2335,7 @@ func testPutMultipartObjectWithChecksums(trailing bool) {
args := map[string]interface{}{ args := map[string]interface{}{
"bucketName": "", "bucketName": "",
"objectName": "", "objectName": "",
"opts": fmt.Sprintf("minio.PutObjectOptions{UserMetadata: metadata, Trailing: %v}", trailing), "opts": "minio.PutObjectOptions{UserMetadata: metadata, Trailing: true}",
} }
if !isFullMode() { if !isFullMode() {
@@ -2339,7 +2343,7 @@ func testPutMultipartObjectWithChecksums(trailing bool) {
return return
} }
c, err := NewClient(ClientConfig{TrailingHeaders: trailing}) c, err := NewClient(ClientConfig{TrailingHeaders: true})
if err != nil { if err != nil {
logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
return return
@@ -2433,12 +2437,8 @@ func testPutMultipartObjectWithChecksums(trailing bool) {
h.Reset() h.Reset()
want := hashMultiPart(b, partSize, test.cs) want := hashMultiPart(b, partSize, test.cs)
var cs minio.ChecksumType rd := bytes.NewReader(b)
rd := io.Reader(io.NopCloser(bytes.NewReader(b))) cs := test.cs
if trailing {
cs = test.cs
rd = bytes.NewReader(b)
}
// Set correct CRC. // Set correct CRC.
args["section"] = "PutObject" args["section"] = "PutObject"
@@ -2447,7 +2447,6 @@ func testPutMultipartObjectWithChecksums(trailing bool) {
DisableMultipart: false, DisableMultipart: false,
UserMetadata: nil, UserMetadata: nil,
PartSize: partSize, PartSize: partSize,
AutoChecksum: test.cs,
Checksum: cs, Checksum: cs,
}) })
if err != nil { if err != nil {
@@ -2589,11 +2588,10 @@ func testTrailingChecksums() {
return return
} }
hashMultiPart := func(b []byte, partSize int, hasher hash.Hash) string { hashMultiPart := func(b []byte, partSize int, hasher hash.Hash) (oparts []minio.ObjectPart) {
r := bytes.NewReader(b) r := bytes.NewReader(b)
tmp := make([]byte, partSize) tmp := make([]byte, partSize)
parts := 0 parts := 0
var all []byte
for { for {
n, err := io.ReadFull(r, tmp) n, err := io.ReadFull(r, tmp)
if err != nil && err != io.ErrUnexpectedEOF { if err != nil && err != io.ErrUnexpectedEOF {
@@ -2605,14 +2603,16 @@ func testTrailingChecksums() {
parts++ parts++
hasher.Reset() hasher.Reset()
hasher.Write(tmp[:n]) hasher.Write(tmp[:n])
all = append(all, hasher.Sum(nil)...) oparts = append(oparts, minio.ObjectPart{
PartNumber: parts,
Size: int64(n),
ChecksumCRC32C: base64.StdEncoding.EncodeToString(hasher.Sum(nil)),
})
if err != nil { if err != nil {
break break
} }
} }
hasher.Reset() return oparts
hasher.Write(all)
return fmt.Sprintf("%s-%d", base64.StdEncoding.EncodeToString(hasher.Sum(nil)), parts)
} }
defer cleanupBucket(bucketName, c) defer cleanupBucket(bucketName, c)
tests := []struct { tests := []struct {
@@ -2636,6 +2636,7 @@ func testTrailingChecksums() {
DisableMultipart: false, DisableMultipart: false,
UserMetadata: nil, UserMetadata: nil,
PartSize: 5 << 20, PartSize: 5 << 20,
Checksum: minio.ChecksumFullObjectCRC32C,
}, },
}, },
{ {
@@ -2647,6 +2648,7 @@ func testTrailingChecksums() {
DisableMultipart: false, DisableMultipart: false,
UserMetadata: nil, UserMetadata: nil,
PartSize: 6_645_654, // Rather arbitrary size PartSize: 6_645_654, // Rather arbitrary size
Checksum: minio.ChecksumFullObjectCRC32C,
}, },
}, },
{ {
@@ -2658,6 +2660,7 @@ func testTrailingChecksums() {
DisableMultipart: false, DisableMultipart: false,
UserMetadata: nil, UserMetadata: nil,
PartSize: 5 << 20, PartSize: 5 << 20,
Checksum: minio.ChecksumFullObjectCRC32C,
}, },
}, },
{ {
@@ -2669,6 +2672,7 @@ func testTrailingChecksums() {
DisableMultipart: false, DisableMultipart: false,
UserMetadata: nil, UserMetadata: nil,
PartSize: 6_645_654, // Rather arbitrary size PartSize: 6_645_654, // Rather arbitrary size
Checksum: minio.ChecksumFullObjectCRC32C,
}, },
}, },
} }
@@ -2696,7 +2700,14 @@ func testTrailingChecksums() {
reader.Close() reader.Close()
h := test.hasher h := test.hasher
h.Reset() h.Reset()
test.ChecksumCRC32C = hashMultiPart(b, int(test.PO.PartSize), test.hasher)
parts := hashMultiPart(b, int(test.PO.PartSize), test.hasher)
cksum, err := minio.ChecksumFullObjectCRC32C.FullObjectChecksum(parts)
if err != nil {
logError(testName, function, args, startTime, "", "checksum calculation failed", err)
return
}
test.ChecksumCRC32C = cksum.Encoded()
// Set correct CRC. // Set correct CRC.
resp, err := c.PutObject(context.Background(), bucketName, objectName, bytes.NewReader(b), int64(bufSize), test.PO) resp, err := c.PutObject(context.Background(), bucketName, objectName, bytes.NewReader(b), int64(bufSize), test.PO)
@@ -4172,7 +4183,7 @@ func testFPutObjectMultipart() {
"opts": "", "opts": "",
} }
c, err := NewClient(ClientConfig{}) c, err := NewClient(ClientConfig{TrailingHeaders: true})
if err != nil { if err != nil {
logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
return return
@@ -5586,6 +5597,161 @@ func testPresignedPostPolicyWrongFile() {
logSuccess(testName, function, args, startTime) logSuccess(testName, function, args, startTime)
} }
// testPresignedPostPolicyEmptyFileName tests that an empty file name in the presigned post policy
func testPresignedPostPolicyEmptyFileName() {
// initialize logging params
startTime := time.Now()
testName := getFuncName()
function := "PresignedPostPolicy(policy)"
args := map[string]interface{}{
"policy": "",
}
c, err := NewClient(ClientConfig{})
if err != nil {
logError(testName, function, args, startTime, "", "MinIO client object creation failed", err)
return
}
// Generate a new random bucket name.
bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
// Make a new bucket in 'us-east-1' (source bucket).
err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
if err != nil {
logError(testName, function, args, startTime, "", "MakeBucket failed", err)
return
}
defer cleanupBucket(bucketName, c)
// Generate 33K of data.
reader := getDataReader("datafile-33-kB")
defer reader.Close()
objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
// Azure requires the key to not start with a number
metadataKey := randString(60, rand.NewSource(time.Now().UnixNano()), "user")
metadataValue := randString(60, rand.NewSource(time.Now().UnixNano()), "")
buf, err := io.ReadAll(reader)
if err != nil {
logError(testName, function, args, startTime, "", "ReadAll failed", err)
return
}
policy := minio.NewPostPolicy()
policy.SetBucket(bucketName)
policy.SetKey(objectName)
policy.SetExpires(time.Now().UTC().AddDate(0, 0, 10)) // expires in 10 days
policy.SetContentType("binary/octet-stream")
policy.SetContentLengthRange(10, 1024*1024)
policy.SetUserMetadata(metadataKey, metadataValue)
policy.SetContentEncoding("gzip")
// Add CRC32C
checksum := minio.ChecksumCRC32C.ChecksumBytes(buf)
err = policy.SetChecksum(checksum)
if err != nil {
logError(testName, function, args, startTime, "", "SetChecksum failed", err)
return
}
args["policy"] = policy.String()
presignedPostPolicyURL, formData, err := c.PresignedPostPolicy(context.Background(), policy)
if err != nil {
logError(testName, function, args, startTime, "", "PresignedPostPolicy failed", err)
return
}
var formBuf bytes.Buffer
writer := multipart.NewWriter(&formBuf)
for k, v := range formData {
writer.WriteField(k, v)
}
// Get a 33KB file to upload and test if set post policy works
filePath := getMintDataDirFilePath("datafile-33-kB")
if filePath == "" {
// Make a temp file with 33 KB data.
file, err := os.CreateTemp(os.TempDir(), "PresignedPostPolicyTest")
if err != nil {
logError(testName, function, args, startTime, "", "TempFile creation failed", err)
return
}
if _, err = io.Copy(file, getDataReader("datafile-33-kB")); err != nil {
logError(testName, function, args, startTime, "", "Copy failed", err)
return
}
if err = file.Close(); err != nil {
logError(testName, function, args, startTime, "", "File Close failed", err)
return
}
filePath = file.Name()
}
// add file to post request
f, err := os.Open(filePath)
defer f.Close()
if err != nil {
logError(testName, function, args, startTime, "", "File open failed", err)
return
}
w, err := writer.CreateFormFile("", filePath)
if err != nil {
logError(testName, function, args, startTime, "", "CreateFormFile failed", err)
return
}
_, err = io.Copy(w, f)
if err != nil {
logError(testName, function, args, startTime, "", "Copy failed", err)
return
}
writer.Close()
httpClient := &http.Client{
// Setting a sensible time out of 30secs to wait for response
// headers. Request is pro-actively canceled after 30secs
// with no response.
Timeout: 30 * time.Second,
Transport: createHTTPTransport(),
}
args["url"] = presignedPostPolicyURL.String()
req, err := http.NewRequest(http.MethodPost, presignedPostPolicyURL.String(), bytes.NewReader(formBuf.Bytes()))
if err != nil {
logError(testName, function, args, startTime, "", "Http request failed", err)
return
}
req.Header.Set("Content-Type", writer.FormDataContentType())
// make post request with correct form data
res, err := httpClient.Do(req)
if err != nil {
logError(testName, function, args, startTime, "", "Http request failed", err)
return
}
defer res.Body.Close()
if res.StatusCode != http.StatusBadRequest {
logError(testName, function, args, startTime, "", "Http request failed", errors.New(res.Status))
return
}
body, err := io.ReadAll(res.Body)
if err != nil {
logError(testName, function, args, startTime, "", "ReadAll failed", err)
return
}
if !strings.Contains(string(body), "MalformedPOSTRequest") {
logError(testName, function, args, startTime, "", "Invalid error from server", errors.New(string(body)))
}
logSuccess(testName, function, args, startTime)
}
// Tests copy object // Tests copy object
func testCopyObject() { func testCopyObject() {
// initialize logging params // initialize logging params
@@ -11560,8 +11726,11 @@ func testPutObjectMetadataNonUSASCIIV2() {
} }
for k, v := range metadata { for k, v := range metadata {
if strings.HasPrefix(strings.ToLower(k), "x-amz-checksum-") {
continue
}
if st.Metadata.Get(http.CanonicalHeaderKey("X-Amz-Meta-"+k)) != v { if st.Metadata.Get(http.CanonicalHeaderKey("X-Amz-Meta-"+k)) != v {
logError(testName, function, args, startTime, "", "Expected upload object metadata "+k+": "+v+" but got "+st.Metadata.Get("X-Amz-Meta-"+k), err) logError(testName, function, args, startTime, "", "Expected upload object metadata "+k+": "+v+" but got "+st.Metadata.Get(http.CanonicalHeaderKey("X-Amz-Meta-"+k)), err)
return return
} }
} }
@@ -14069,8 +14238,7 @@ func main() {
testUserMetadataCopyingV2() testUserMetadataCopyingV2()
testPutObjectWithChecksums() testPutObjectWithChecksums()
testPutObjectWithTrailingChecksums() testPutObjectWithTrailingChecksums()
testPutMultipartObjectWithChecksums(false) testPutMultipartObjectWithChecksums()
testPutMultipartObjectWithChecksums(true)
testPutObject0ByteV2() testPutObject0ByteV2()
testPutObjectMetadataNonUSASCIIV2() testPutObjectMetadataNonUSASCIIV2()
testPutObjectNoLengthV2() testPutObjectNoLengthV2()
@@ -14098,6 +14266,7 @@ func main() {
testGetObjectReadAtWhenEOFWasReached() testGetObjectReadAtWhenEOFWasReached()
testPresignedPostPolicy() testPresignedPostPolicy()
testPresignedPostPolicyWrongFile() testPresignedPostPolicyWrongFile()
testPresignedPostPolicyEmptyFileName()
testCopyObject() testCopyObject()
testComposeObjectErrorCases() testComposeObjectErrorCases()
testCompose10KSources() testCompose10KSources()
+1 -1
View File
@@ -84,7 +84,7 @@ func (hr *hookReader) Read(b []byte) (n int, err error) {
// reports the data read from the source to the hook. // reports the data read from the source to the hook.
func newHook(source, hook io.Reader) io.Reader { func newHook(source, hook io.Reader) io.Reader {
if hook == nil { if hook == nil {
return source return &hookReader{source: source}
} }
return &hookReader{ return &hookReader{
source: source, source: source,
+1 -4
View File
@@ -125,6 +125,7 @@ func (i *STSCertificateIdentity) RetrieveWithCredContext(cc *CredContext) (Value
queryValues := url.Values{} queryValues := url.Values{}
queryValues.Set("Action", "AssumeRoleWithCertificate") queryValues.Set("Action", "AssumeRoleWithCertificate")
queryValues.Set("Version", STSVersion) queryValues.Set("Version", STSVersion)
queryValues.Set("DurationSeconds", strconv.FormatUint(uint64(livetime.Seconds()), 10))
if i.TokenRevokeType != "" { if i.TokenRevokeType != "" {
queryValues.Set("TokenRevokeType", i.TokenRevokeType) queryValues.Set("TokenRevokeType", i.TokenRevokeType)
} }
@@ -134,10 +135,6 @@ func (i *STSCertificateIdentity) RetrieveWithCredContext(cc *CredContext) (Value
if err != nil { if err != nil {
return Value{}, err return Value{}, err
} }
if req.Form == nil {
req.Form = url.Values{}
}
req.Form.Add("DurationSeconds", strconv.FormatUint(uint64(livetime.Seconds()), 10))
client := i.Client client := i.Client
if client == nil { if client == nil {
@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package utils package peeker
import ( import (
"bytes" "bytes"
+1 -1
View File
@@ -417,7 +417,7 @@ func (p PostPolicy) String() string {
// marshalJSON - Provides Marshaled JSON in bytes. // marshalJSON - Provides Marshaled JSON in bytes.
func (p PostPolicy) marshalJSON() []byte { func (p PostPolicy) marshalJSON() []byte {
expirationStr := `"expiration":"` + p.expiration.Format(expirationDateFormat) + `"` expirationStr := `"expiration":"` + p.expiration.UTC().Format(expirationDateFormat) + `"`
var conditionsStr string var conditionsStr string
conditions := []string{} conditions := []string{}
for _, po := range p.conditions { for _, po := range p.conditions {
+1 -1
View File
@@ -42,4 +42,4 @@ _testmain.go
.idea .idea
# VS Code # VS Code
.vscode .vscode
+1 -1
View File
@@ -23,7 +23,7 @@ A [Go](http://golang.org) client for the [NATS messaging system](https://nats.io
go get github.com/nats-io/nats.go@latest go get github.com/nats-io/nats.go@latest
# To get a specific version: # To get a specific version:
go get github.com/nats-io/nats.go@v1.43.0 go get github.com/nats-io/nats.go@v1.44.0
# Note that the latest major version for NATS Server is v2: # Note that the latest major version for NATS Server is v2:
go get github.com/nats-io/nats-server/v2@latest go get github.com/nats-io/nats-server/v2@latest
+86 -31
View File
@@ -6,33 +6,30 @@ This doc covers the basic usage of the `jetstream` package in `nats.go` client.
- [Overview](#overview) - [Overview](#overview)
- [Basic usage](#basic-usage) - [Basic usage](#basic-usage)
- [Streams](#streams) - [Streams](#streams)
- [Stream management (CRUD)](#stream-management-crud) - [Stream management (CRUD)](#stream-management-crud)
- [Listing streams and stream names](#listing-streams-and-stream-names) - [Listing streams and stream names](#listing-streams-and-stream-names)
- [Stream-specific operations](#stream-specific-operations) - [Stream-specific operations](#stream-specific-operations)
- [Consumers](#consumers) - [Consumers](#consumers)
- [Consumers management](#consumers-management) - [Consumers management](#consumers-management)
- [Listing consumers and consumer - [Listing consumers and consumer names](#listing-consumers-and-consumer-names)
names](#listing-consumers-and-consumer-names) - [Ordered consumers](#ordered-consumers)
- [Ordered consumers](#ordered-consumers) - [Receiving messages from pull consumers](#receiving-messages-from-pull-consumers)
- [Receiving messages from the - [Single fetch](#single-fetch)
consumer](#receiving-messages-from-the-consumer) - [Continuous polling](#continuous-polling)
- [Single fetch](#single-fetch) - [Using `Consume()` receive messages in a callback](#using-consume-receive-messages-in-a-callback)
- [Continuous polling](#continuous-polling) - [Using `Messages()` to iterate over incoming messages](#using-messages-to-iterate-over-incoming-messages)
- [Using `Consume()` receive messages in a - [Receiving messages from push consumers](#receiving-messages-from-push-consumers)
callback](#using-consume-receive-messages-in-a-callback)
- [Using `Messages()` to iterate over incoming
messages](#using-messages-to-iterate-over-incoming-messages)
- [Publishing on stream](#publishing-on-stream) - [Publishing on stream](#publishing-on-stream)
- [Synchronous publish](#synchronous-publish) - [Synchronous publish](#synchronous-publish)
- [Async publish](#async-publish) - [Async publish](#async-publish)
- [KeyValue Store](#keyvalue-store) - [KeyValue Store](#keyvalue-store)
- [Basic usage of KV bucket](#basic-usage-of-kv-bucket) - [Basic usage of KV bucket](#basic-usage-of-kv-bucket)
- [Watching for changes on a bucket](#watching-for-changes-on-a-bucket) - [Watching for changes on a bucket](#watching-for-changes-on-a-bucket)
- [Additional operations on a bucket](#additional-operations-on-a-bucket) - [Additional operations on a bucket](#additional-operations-on-a-bucket)
- [Object Store](#object-store) - [Object Store](#object-store)
- [Basic usage of Object Store](#basic-usage-of-object-store) - [Basic usage of Object Store](#basic-usage-of-object-store)
- [Watching for changes on a store](#watching-for-changes-on-a-store) - [Watching for changes on a store](#watching-for-changes-on-a-store)
- [Additional operations on a store](#additional-operations-on-a-store) - [Additional operations on a store](#additional-operations-on-a-store)
- [Examples](#examples) - [Examples](#examples)
## Overview ## Overview
@@ -254,14 +251,34 @@ fmt.Println(cachedInfo.Config.Name)
## Consumers ## Consumers
Only pull consumers are supported in `jetstream` package. However, unlike the Both pull and push consumers are supported in `jetstream` package. For most use
JetStream API in `nats` package, pull consumers allow for continuous message cases, we recommend using pull consumers as they allow for more fine-grained
retrieval (similarly to how `nats.Subscribe()` works). Because of that, push control over the message processing and can often prevent issues such as e.g.
consumers can be easily replaced by pull consumers for most of the use cases. slow consumers. However, unlike the JetStream API in `nats` package, pull
consumers allow for continuous message retrieval (similarly to how
`nats.Subscribe()` works). Because of that, push consumers can be easily
replaced by pull consumers for most of the use cases. Push consumers are
supported mainly for the purpose of ease of migration from `nats` package. The
interfaces for consuming messages via push and pull consumers are similar, with
the main difference being that push consumers do not support fetching individual
batches of messages.
### Consumers management ### Consumers management
CRUD operations on consumers can be achieved on 2 levels: Both pull and push consumers can be managed using `jetstream` package. The
following example demonstrates how to create, update, fetch and delete a pull
consumer. Push consumers can be managed in a similar way, with method names
containing `Push` (e.g. `CreatePushConsumer`, `UpdatePushConsumer`,
`DeletePushConsumer`).
> __NOTE__: It is important to use `CreateConsumer` and `CreatePushConsumer`
methods to create the respective consumer types as they return the correct
interface (different for push and pull consumers). `DeliverSubject` is mandatory
when creating a push consumer and cannot be provided when creating a pull
consumer. Similarly, an attempt to get a push consumer using `Consumer` method
will result in an error (and vice versa).
CRUD operations on pull consumers can be achieved on 2 levels:
- on `JetStream` interface - on `JetStream` interface
@@ -370,6 +387,8 @@ message ordering. It is also resilient to consumer deletion.
Ordered consumers present the same set of message consumption methods as Ordered consumers present the same set of message consumption methods as
standard pull consumers. standard pull consumers.
> __NOTE__: Ordered consumers are not supported for push consumers.
```go ```go
js, _ := jetstream.New(nc) js, _ := jetstream.New(nc)
@@ -380,7 +399,7 @@ cons, _ := js.OrderedConsumer(ctx, "ORDERS", jetstream.OrderedConsumerConfig{
}) })
``` ```
### Receiving messages from the consumer ### Receiving messages from pull consumers
The `Consumer` interface covers allows fetching messages on demand, with The `Consumer` interface covers allows fetching messages on demand, with
pre-defined batch size on bytes limit, or continuous push-like receiving of pre-defined batch size on bytes limit, or continuous push-like receiving of
@@ -469,10 +488,12 @@ cons, _ := js.CreateOrUpdateConsumer("ORDERS", jetstream.ConsumerConfig{
AckPolicy: jetstream.AckExplicitPolicy, AckPolicy: jetstream.AckExplicitPolicy,
// receive messages from ORDERS.A subject only // receive messages from ORDERS.A subject only
FilterSubject: "ORDERS.A" FilterSubject: "ORDERS.A"
})) })
consContext, _ := c.Consume(func(msg jetstream.Msg) { consContext, _ := c.Consume(func(msg jetstream.Msg) {
fmt.Printf("Received a JetStream message: %s\n", string(msg.Data())) fmt.Printf("Received a JetStream message: %s\n", string(msg.Data()))
// messages are not acknowledged automatically
msg.Ack()
}) })
defer consContext.Stop() defer consContext.Stop()
``` ```
@@ -497,7 +518,7 @@ type PullThresholdMessages int
buffer buffer
- `PullHeartbeat(time.Duration)` - idle heartbeat duration for a single pull - `PullHeartbeat(time.Duration)` - idle heartbeat duration for a single pull
request. An error will be triggered if at least 2 heartbeats are missed request. An error will be triggered if at least 2 heartbeats are missed
- `WithConsumeErrHandler(func (ConsumeContext, error))` - when used, sets a - `ConsumeErrHandler(func (ConsumeContext, error))` - when used, sets a
custom error handler on `Consume()`, allowing e.g. tracking missing custom error handler on `Consume()`, allowing e.g. tracking missing
heartbeats. heartbeats.
- `PullMaxMessagesWithBytesLimit` - up to the provided number of messages will - `PullMaxMessagesWithBytesLimit` - up to the provided number of messages will
@@ -591,6 +612,40 @@ for {
} }
``` ```
#### Receiving messages from push consumers
The `PushConsumer` interface currently only allows message processing in a
callback using `Consume()`.
As heartbeat for push consumers is not managed when using `Consume()`, it is
important to set `IdleHeartbeat` on the consumer level. Similarly, `FlowControl`
can be set to prevent the consumer from receiving more messages than it can
handle.
```go
cons, _ := js.CreateOrUpdatePushConsumer("ORDERS", jetstream.ConsumerConfig{
DeliverSubject: nats.NewInbox()
AckPolicy: jetstream.AckExplicitPolicy,
// receive messages from ORDERS.A subject only
FilterSubject: "ORDERS.A",
// unlike pull consumers, idle heartbeat is configured on the consumer level
IdleHeartbeat: 30 * time.Second
})
consContext, _ := c.Consume(func(msg jetstream.Msg) {
fmt.Printf("Received a JetStream message: %s\n", string(msg.Data()))
// messages are not acknowledged automatically
msg.Ack()
})
defer consContext.Stop()
```
`Consume()` on `PushConsumer` can be supplied with `ConsumeErrHandler` option
to set a custom error handler allowing e.g. tracking missing heartbeats.
> __NOTE__: `Stop()` should always be called on `ConsumeContext` to avoid
> leaking goroutines.
## Publishing on stream ## Publishing on stream
`JetStream` interface allows publishing messages on stream in 2 ways: `JetStream` interface allows publishing messages on stream in 2 ways:
+4 -4
View File
@@ -127,8 +127,8 @@ func (js *jetStream) apiRequest(ctx context.Context, subj string, data ...[]byte
if len(data) > 0 { if len(data) > 0 {
req = data[0] req = data[0]
} }
if js.opts.clientTrace != nil { if js.opts.ClientTrace != nil {
ctrace := js.opts.clientTrace ctrace := js.opts.ClientTrace
if ctrace.RequestSent != nil { if ctrace.RequestSent != nil {
ctrace.RequestSent(subj, req) ctrace.RequestSent(subj, req)
} }
@@ -137,8 +137,8 @@ func (js *jetStream) apiRequest(ctx context.Context, subj string, data ...[]byte
if err != nil { if err != nil {
return nil, err return nil, err
} }
if js.opts.clientTrace != nil { if js.opts.ClientTrace != nil {
ctrace := js.opts.clientTrace ctrace := js.opts.ClientTrace
if ctrace.ResponseReceived != nil { if ctrace.ResponseReceived != nil {
ctrace.ResponseReceived(subj, resp.Data, resp.Header) ctrace.ResponseReceived(subj, resp.Data, resp.Header)
} }
+127 -19
View File
@@ -147,6 +147,21 @@ type (
CachedInfo() *ConsumerInfo CachedInfo() *ConsumerInfo
} }
PushConsumer interface {
// Consume will continuously receive messages and handle them
// with the provided callback function. Consume can be configured using
// PushConsumeOpt options:
//
// - Error handling and monitoring can be configured using ConsumeErrHandler.
Consume(handler MessageHandler, opts ...PushConsumeOpt) (ConsumeContext, error)
// Info fetches current ConsumerInfo from the server.
Info(context.Context) (*ConsumerInfo, error)
// CachedInfo returns ConsumerInfo currently cached on this consumer.
CachedInfo() *ConsumerInfo
}
createConsumerRequest struct { createConsumerRequest struct {
Stream string `json:"stream_name"` Stream string `json:"stream_name"`
Config *ConsumerConfig `json:"config"` Config *ConsumerConfig `json:"config"`
@@ -187,7 +202,74 @@ func (p *pullConsumer) CachedInfo() *ConsumerInfo {
return p.info return p.info
} }
func upsertConsumer(ctx context.Context, js *jetStream, stream string, cfg ConsumerConfig, action string) (Consumer, error) { // Info fetches current ConsumerInfo from the server.
func (p *pushConsumer) Info(ctx context.Context) (*ConsumerInfo, error) {
ctx, cancel := p.js.wrapContextWithoutDeadline(ctx)
if cancel != nil {
defer cancel()
}
infoSubject := fmt.Sprintf(apiConsumerInfoT, p.stream, p.name)
var resp consumerInfoResponse
if _, err := p.js.apiRequestJSON(ctx, infoSubject, &resp); err != nil {
return nil, err
}
if resp.Error != nil {
if resp.Error.ErrorCode == JSErrCodeConsumerNotFound {
return nil, ErrConsumerNotFound
}
return nil, resp.Error
}
if resp.Error == nil && resp.ConsumerInfo == nil {
return nil, ErrConsumerNotFound
}
p.info = resp.ConsumerInfo
return resp.ConsumerInfo, nil
}
// CachedInfo returns ConsumerInfo currently cached on this consumer.
// This method does not perform any network requests. The cached
// ConsumerInfo is updated on every call to Info and Update.
func (p *pushConsumer) CachedInfo() *ConsumerInfo {
return p.info
}
func upsertPullConsumer(ctx context.Context, js *jetStream, stream string, cfg ConsumerConfig, action string) (Consumer, error) {
resp, err := upsertConsumer(ctx, js, stream, cfg, action)
if err != nil {
return nil, err
}
return &pullConsumer{
js: js,
stream: stream,
name: resp.Name,
durable: cfg.Durable != "",
info: resp.ConsumerInfo,
subs: syncx.Map[string, *pullSubscription]{},
}, nil
}
func upsertPushConsumer(ctx context.Context, js *jetStream, stream string, cfg ConsumerConfig, action string) (PushConsumer, error) {
if cfg.DeliverSubject == "" {
return nil, ErrNotPushConsumer
}
resp, err := upsertConsumer(ctx, js, stream, cfg, action)
if err != nil {
return nil, err
}
return &pushConsumer{
js: js,
stream: stream,
name: resp.Name,
info: resp.ConsumerInfo,
}, nil
}
func upsertConsumer(ctx context.Context, js *jetStream, stream string, cfg ConsumerConfig, action string) (*consumerInfoResponse, error) {
ctx, cancel := js.wrapContextWithoutDeadline(ctx) ctx, cancel := js.wrapContextWithoutDeadline(ctx)
if cancel != nil { if cancel != nil {
defer cancel() defer cancel()
@@ -240,14 +322,7 @@ func upsertConsumer(ctx context.Context, js *jetStream, stream string, cfg Consu
return nil, ErrConsumerMultipleFilterSubjectsNotSupported return nil, ErrConsumerMultipleFilterSubjectsNotSupported
} }
return &pullConsumer{ return &resp, nil
js: js,
stream: stream,
name: resp.Name,
durable: cfg.Durable != "",
info: resp.ConsumerInfo,
subs: syncx.Map[string, *pullSubscription]{},
}, nil
} }
const ( const (
@@ -268,6 +343,48 @@ func generateConsName() string {
} }
func getConsumer(ctx context.Context, js *jetStream, stream, name string) (Consumer, error) { func getConsumer(ctx context.Context, js *jetStream, stream, name string) (Consumer, error) {
info, err := fetchConsumerInfo(ctx, js, stream, name)
if err != nil {
return nil, err
}
if info.Config.DeliverSubject != "" {
return nil, ErrNotPullConsumer
}
cons := &pullConsumer{
js: js,
stream: stream,
name: name,
durable: info.Config.Durable != "",
info: info,
subs: syncx.Map[string, *pullSubscription]{},
}
return cons, nil
}
func getPushConsumer(ctx context.Context, js *jetStream, stream, name string) (PushConsumer, error) {
info, err := fetchConsumerInfo(ctx, js, stream, name)
if err != nil {
return nil, err
}
if info.Config.DeliverSubject == "" {
return nil, ErrNotPushConsumer
}
cons := &pushConsumer{
js: js,
stream: stream,
name: name,
info: info,
}
return cons, nil
}
func fetchConsumerInfo(ctx context.Context, js *jetStream, stream, name string) (*ConsumerInfo, error) {
ctx, cancel := js.wrapContextWithoutDeadline(ctx) ctx, cancel := js.wrapContextWithoutDeadline(ctx)
if cancel != nil { if cancel != nil {
defer cancel() defer cancel()
@@ -292,16 +409,7 @@ func getConsumer(ctx context.Context, js *jetStream, stream, name string) (Consu
return nil, ErrConsumerNotFound return nil, ErrConsumerNotFound
} }
cons := &pullConsumer{ return resp.ConsumerInfo, nil
js: js,
stream: stream,
name: name,
durable: resp.Config.Durable != "",
info: resp.ConsumerInfo,
subs: syncx.Map[string, *pullSubscription]{},
}
return cons, nil
} }
func deleteConsumer(ctx context.Context, js *jetStream, stream, consumer string) error { func deleteConsumer(ctx context.Context, js *jetStream, stream, consumer string) error {
+22 -1
View File
@@ -98,7 +98,8 @@ type (
PinnedTS time.Time `json:"pinned_ts,omitempty"` PinnedTS time.Time `json:"pinned_ts,omitempty"`
} }
// ConsumerConfig is the configuration of a JetStream consumer. // ConsumerConfig represents the configuration of a JetStream consumer,
// encompassing both push and pull consumer settings
ConsumerConfig struct { ConsumerConfig struct {
// Name is an optional name for the consumer. If not set, one is // Name is an optional name for the consumer. If not set, one is
// generated automatically. // generated automatically.
@@ -253,6 +254,26 @@ type (
// PriorityGroups is a list of priority groups this consumer supports. // PriorityGroups is a list of priority groups this consumer supports.
PriorityGroups []string `json:"priority_groups,omitempty"` PriorityGroups []string `json:"priority_groups,omitempty"`
// Fields specific for push consumers:
// DeliverSubject is the subject to deliver messages to for push consumers
DeliverSubject string `json:"deliver_subject,omitempty"`
// DeliverGroup is the group name for push consumers
DeliverGroup string `json:"deliver_group,omitempty"`
// FlowControl is a flag to enable flow control for the consumer.
// When set, server will regularly send an empty message with Status
// header 100 and a reply subject, consumers must reply to these
// messages to control the rate of message delivery
FlowControl bool `json:"flow_control,omitempty"`
// IdleHeartbeat enables push consumer idle heartbeat messages.
// If the Consumer is idle for more than the set value, an empty message
// with Status header 100 will be sent indicating the consumer is still
// alive.
IdleHeartbeat time.Duration `json:"idle_heartbeat,omitempty"`
} }
// OrderedConsumerConfig is the configuration of an ordered JetStream // OrderedConsumerConfig is the configuration of an ordered JetStream
+20
View File
@@ -161,6 +161,18 @@ var (
// does not exist. // does not exist.
ErrConsumerNameAlreadyInUse JetStreamError = &jsError{message: "consumer name already in use"} ErrConsumerNameAlreadyInUse JetStreamError = &jsError{message: "consumer name already in use"}
// ErrNotPullConsumer is returned when attempting to fetch or create pull
// consumer and the returned consumer is a push consumer.
ErrNotPullConsumer JetStreamError = &jsError{message: "consumer is not a pull consumer"}
// ErrNotPushConsumer is returned when attempting to fetch or create push
// consumer and the returned consumer is a pull consumer.
ErrNotPushConsumer JetStreamError = &jsError{message: "consumer is not a push consumer"}
// ErrConsumerAlreadyConsuming is returned when attempting to consume from
// the same push consumer more than once.
ErrConsumerAlreadyConsuming JetStreamError = &jsError{message: "consumer is already consuming"}
// ErrInvalidJSAck is returned when JetStream ack from message publish is // ErrInvalidJSAck is returned when JetStream ack from message publish is
// invalid. // invalid.
ErrInvalidJSAck JetStreamError = &jsError{message: "invalid jetstream publish response"} ErrInvalidJSAck JetStreamError = &jsError{message: "invalid jetstream publish response"}
@@ -259,6 +271,14 @@ var (
// closed iterator. // closed iterator.
ErrMsgIteratorClosed JetStreamError = &jsError{message: "messages iterator closed"} ErrMsgIteratorClosed JetStreamError = &jsError{message: "messages iterator closed"}
// ErrConnectionClosed is returned when JetStream operations fail due to
// underlying connection being closed.
ErrConnectionClosed JetStreamError = &jsError{message: "connection closed"}
// ErrServerShutdown is returned when pull request fails due to server
// shutdown.
ErrServerShutdown JetStreamError = &jsError{message: "server shutdown"}
// ErrOrderedConsumerReset is returned when resetting ordered consumer fails // ErrOrderedConsumerReset is returned when resetting ordered consumer fails
// due to too many attempts. // due to too many attempts.
ErrOrderedConsumerReset JetStreamError = &jsError{message: "recreating ordered consumer"} ErrOrderedConsumerReset JetStreamError = &jsError{message: "recreating ordered consumer"}
+106 -13
View File
@@ -19,6 +19,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"regexp" "regexp"
"slices"
"strings" "strings"
"time" "time"
@@ -210,6 +211,31 @@ type (
// ResumeConsumer resumes a paused consumer. // ResumeConsumer resumes a paused consumer.
ResumeConsumer(ctx context.Context, stream string, consumer string) (*ConsumerPauseResponse, error) ResumeConsumer(ctx context.Context, stream string, consumer string) (*ConsumerPauseResponse, error)
// CreateOrUpdatePushConsumer creates a push consumer on a given stream with
// given config. If consumer already exists, it will be updated (if
// possible). Consumer interface is returned, allowing to consume messages.
CreateOrUpdatePushConsumer(ctx context.Context, stream string, cfg ConsumerConfig) (PushConsumer, error)
// CreatePushConsumer creates a push consumer on a given stream with given
// config. If consumer already exists and the provided configuration
// differs from its configuration, ErrConsumerExists is returned. If the
// provided configuration is the same as the existing consumer, the
// existing consumer is returned. Consumer interface is returned,
// allowing to consume messages.
CreatePushConsumer(ctx context.Context, stream string, cfg ConsumerConfig) (PushConsumer, error)
// UpdatePushConsumer updates an existing push consumer. If consumer does not
// exist, ErrConsumerDoesNotExist is returned. Consumer interface is
// returned, allowing to consume messages.
UpdatePushConsumer(ctx context.Context, stream string, cfg ConsumerConfig) (PushConsumer, error)
// PushConsumer returns an interface to an existing push consumer, allowing processing
// of messages. If consumer does not exist, ErrConsumerNotFound is
// returned.
//
// It returns ErrNotPushConsumer if the consumer is not a push consumer (deliver subject is not set).
PushConsumer(ctx context.Context, stream string, consumer string) (PushConsumer, error)
} }
// StreamListOpt is a functional option for [StreamManager.ListStreams] and // StreamListOpt is a functional option for [StreamManager.ListStreams] and
@@ -315,6 +341,9 @@ type (
// a deadline set. // a deadline set.
DefaultTimeout time.Duration DefaultTimeout time.Duration
// ClientTrace enables request/response API calls tracing.
ClientTrace *ClientTrace
publisherOpts asyncPublisherOpts publisherOpts asyncPublisherOpts
// this is the actual prefix used in the API requests // this is the actual prefix used in the API requests
@@ -322,7 +351,6 @@ type (
apiPrefix string apiPrefix string
replyPrefix string replyPrefix string
replyPrefixLen int replyPrefixLen int
clientTrace *ClientTrace
} }
// ClientTrace can be used to trace API interactions for [JetStream]. // ClientTrace can be used to trace API interactions for [JetStream].
@@ -528,7 +556,13 @@ func (js *jetStream) Conn() *nats.Conn {
} }
func (js *jetStream) Options() JetStreamOptions { func (js *jetStream) Options() JetStreamOptions {
return js.opts opts := js.opts
// Return a copy of ClientTrace to prevent modification
if opts.ClientTrace != nil {
clientTraceCopy := *opts.ClientTrace
opts.ClientTrace = &clientTraceCopy
}
return opts
} }
// CreateStream creates a new stream with given config and returns an // CreateStream creates a new stream with given config and returns an
@@ -592,10 +626,18 @@ func (js *jetStream) CreateStream(ctx context.Context, cfg StreamConfig) (Stream
if len(cfg.Sources) != len(resp.Config.Sources) { if len(cfg.Sources) != len(resp.Config.Sources) {
return nil, ErrStreamSourceNotSupported return nil, ErrStreamSourceNotSupported
} }
for i := range cfg.Sources {
if len(cfg.Sources[i].SubjectTransforms) != 0 && len(resp.Sources[i].SubjectTransforms) == 0 { // the sources list in the response is not ordered
return nil, ErrStreamSourceMultipleFilterSubjectsNotSupported cfgNumTransforms := make([]int, len(cfg.Sources))
} respNumTransforms := make([]int, len(resp.Config.Sources))
for i, cfgSource := range cfg.Sources {
cfgNumTransforms[i] = len(cfgSource.SubjectTransforms)
respNumTransforms[i] = len(resp.Config.Sources[i].SubjectTransforms)
}
slices.Sort(cfgNumTransforms)
slices.Sort(respNumTransforms)
if !slices.Equal(cfgNumTransforms, respNumTransforms) {
return nil, ErrStreamSubjectTransformNotSupported
} }
} }
@@ -672,10 +714,18 @@ func (js *jetStream) UpdateStream(ctx context.Context, cfg StreamConfig) (Stream
if len(cfg.Sources) != len(resp.Config.Sources) { if len(cfg.Sources) != len(resp.Config.Sources) {
return nil, ErrStreamSourceNotSupported return nil, ErrStreamSourceNotSupported
} }
for i := range cfg.Sources {
if len(cfg.Sources[i].SubjectTransforms) != 0 && len(resp.Sources[i].SubjectTransforms) == 0 { // the sources list in the response is not ordered
return nil, ErrStreamSourceMultipleFilterSubjectsNotSupported cfgNumTransforms := make([]int, len(cfg.Sources))
} respNumTransforms := make([]int, len(resp.Config.Sources))
for i, cfgSource := range cfg.Sources {
cfgNumTransforms[i] = len(cfgSource.SubjectTransforms)
respNumTransforms[i] = len(resp.Config.Sources[i].SubjectTransforms)
}
slices.Sort(cfgNumTransforms)
slices.Sort(respNumTransforms)
if !slices.Equal(cfgNumTransforms, respNumTransforms) {
return nil, ErrStreamSubjectTransformNotSupported
} }
} }
@@ -762,7 +812,7 @@ func (js *jetStream) CreateOrUpdateConsumer(ctx context.Context, stream string,
if err := validateStreamName(stream); err != nil { if err := validateStreamName(stream); err != nil {
return nil, err return nil, err
} }
return upsertConsumer(ctx, js, stream, cfg, consumerActionCreateOrUpdate) return upsertPullConsumer(ctx, js, stream, cfg, consumerActionCreateOrUpdate)
} }
// CreateConsumer creates a consumer on a given stream with given // CreateConsumer creates a consumer on a given stream with given
@@ -775,7 +825,7 @@ func (js *jetStream) CreateConsumer(ctx context.Context, stream string, cfg Cons
if err := validateStreamName(stream); err != nil { if err := validateStreamName(stream); err != nil {
return nil, err return nil, err
} }
return upsertConsumer(ctx, js, stream, cfg, consumerActionCreate) return upsertPullConsumer(ctx, js, stream, cfg, consumerActionCreate)
} }
// UpdateConsumer updates an existing consumer. If consumer does not // UpdateConsumer updates an existing consumer. If consumer does not
@@ -785,7 +835,7 @@ func (js *jetStream) UpdateConsumer(ctx context.Context, stream string, cfg Cons
if err := validateStreamName(stream); err != nil { if err := validateStreamName(stream); err != nil {
return nil, err return nil, err
} }
return upsertConsumer(ctx, js, stream, cfg, consumerActionUpdate) return upsertPullConsumer(ctx, js, stream, cfg, consumerActionUpdate)
} }
// OrderedConsumer returns an OrderedConsumer instance. OrderedConsumer // OrderedConsumer returns an OrderedConsumer instance. OrderedConsumer
@@ -832,6 +882,49 @@ func (js *jetStream) DeleteConsumer(ctx context.Context, stream string, name str
return deleteConsumer(ctx, js, stream, name) return deleteConsumer(ctx, js, stream, name)
} }
// CreateOrUpdatePushConsumer creates a push consumer on a given stream with
// given config. If consumer already exists, it will be updated (if
// possible). Consumer interface is returned, allowing to consume messages.
func (js *jetStream) CreateOrUpdatePushConsumer(ctx context.Context, stream string, cfg ConsumerConfig) (PushConsumer, error) {
if err := validateStreamName(stream); err != nil {
return nil, err
}
return upsertPushConsumer(ctx, js, stream, cfg, consumerActionCreateOrUpdate)
}
// CreatePushConsumer creates a push consumer on a given stream with given
// config. If consumer already exists and the provided configuration
// differs from its configuration, ErrConsumerExists is returned. If the
// provided configuration is the same as the existing consumer, the
// existing consumer is returned. Consumer interface is returned,
// allowing to consume messages.
func (js *jetStream) CreatePushConsumer(ctx context.Context, stream string, cfg ConsumerConfig) (PushConsumer, error) {
if err := validateStreamName(stream); err != nil {
return nil, err
}
return upsertPushConsumer(ctx, js, stream, cfg, consumerActionCreate)
}
// UpdatePushConsumer updates an existing push consumer. If consumer does not
// exist, ErrConsumerDoesNotExist is returned. Consumer interface is
// returned, allowing to consume messages.
func (js *jetStream) UpdatePushConsumer(ctx context.Context, stream string, cfg ConsumerConfig) (PushConsumer, error) {
if err := validateStreamName(stream); err != nil {
return nil, err
}
return upsertPushConsumer(ctx, js, stream, cfg, consumerActionUpdate)
}
// PushConsumer returns an interface to an existing consumer, allowing processing
// of messages. If consumer does not exist, ErrConsumerNotFound is
// returned.
func (js *jetStream) PushConsumer(ctx context.Context, stream string, name string) (PushConsumer, error) {
if err := validateStreamName(stream); err != nil {
return nil, err
}
return getPushConsumer(ctx, js, stream, name)
}
func (js *jetStream) PauseConsumer(ctx context.Context, stream string, consumer string, pauseUntil time.Time) (*ConsumerPauseResponse, error) { func (js *jetStream) PauseConsumer(ctx context.Context, stream string, consumer string, pauseUntil time.Time) (*ConsumerPauseResponse, error) {
if err := validateStreamName(stream); err != nil { if err := validateStreamName(stream); err != nil {
return nil, err return nil, err
+11 -6
View File
@@ -31,7 +31,7 @@ func (fn pullOptFunc) configureMessages(opts *consumeOpts) error {
// WithClientTrace enables request/response API calls tracing. // WithClientTrace enables request/response API calls tracing.
func WithClientTrace(ct *ClientTrace) JetStreamOpt { func WithClientTrace(ct *ClientTrace) JetStreamOpt {
return func(opts *JetStreamOptions) error { return func(opts *JetStreamOptions) error {
opts.clientTrace = ct opts.ClientTrace = ct
return nil return nil
} }
} }
@@ -419,11 +419,16 @@ func (nMsgs StopAfter) configureMessages(opts *consumeOpts) error {
// encountered while consuming messages It will be invoked for both terminal // encountered while consuming messages It will be invoked for both terminal
// (Consumer Deleted, invalid request body) and non-terminal (e.g. missing // (Consumer Deleted, invalid request body) and non-terminal (e.g. missing
// heartbeats) errors. // heartbeats) errors.
func ConsumeErrHandler(cb ConsumeErrHandlerFunc) PullConsumeOpt { type ConsumeErrHandler ConsumeErrHandlerFunc
return pullOptFunc(func(cfg *consumeOpts) error {
cfg.ErrHandler = cb func (c ConsumeErrHandler) configureConsume(opts *consumeOpts) error {
return nil opts.ErrHandler = c
}) return nil
}
func (c ConsumeErrHandler) configurePushConsume(opts *pushConsumeOpts) error {
opts.ErrHandler = c
return nil
} }
// WithMessagesErrOnMissingHeartbeat sets whether a missing heartbeat error // WithMessagesErrOnMissingHeartbeat sets whether a missing heartbeat error
+18 -12
View File
@@ -834,10 +834,10 @@ func (js *jetStream) legacyJetStream() (nats.JetStreamContext, error) {
if js.opts.apiPrefix != "" { if js.opts.apiPrefix != "" {
opts = append(opts, nats.APIPrefix(js.opts.apiPrefix)) opts = append(opts, nats.APIPrefix(js.opts.apiPrefix))
} }
if js.opts.clientTrace != nil { if js.opts.ClientTrace != nil {
opts = append(opts, nats.ClientTrace{ opts = append(opts, nats.ClientTrace{
RequestSent: js.opts.clientTrace.RequestSent, RequestSent: js.opts.ClientTrace.RequestSent,
ResponseReceived: js.opts.clientTrace.ResponseReceived, ResponseReceived: js.opts.ClientTrace.ResponseReceived,
}) })
} }
return js.conn.JetStream(opts...) return js.conn.JetStream(opts...)
@@ -1044,7 +1044,11 @@ func (kv *kvs) updateRevision(ctx context.Context, key string, value []byte, rev
if kv.useJSPfx { if kv.useJSPfx {
b.WriteString(kv.js.opts.apiPrefix) b.WriteString(kv.js.opts.apiPrefix)
} }
b.WriteString(kv.pre) if kv.putPre != "" {
b.WriteString(kv.putPre)
} else {
b.WriteString(kv.pre)
}
b.WriteString(key) b.WriteString(key)
m := nats.Msg{Subject: b.String(), Header: nats.Header{}, Data: value} m := nats.Msg{Subject: b.String(), Header: nats.Header{}, Data: value}
@@ -1231,11 +1235,9 @@ func (kv *kvs) WatchFiltered(ctx context.Context, keys []string, opts ...WatchOp
// Check if done and initial values. // Check if done and initial values.
if !w.initDone { if !w.initDone {
w.received++ w.received++
// We set this on the first trip through.. // Use the stable initPending value set at consumer creation.
if w.initPending == 0 { // We're done if we've received all expected messages OR there are no more pending.
w.initPending = delta if w.received >= w.initPending || delta == 0 {
}
if w.received > w.initPending || delta == 0 {
w.initDone = true w.initDone = true
w.updates <- nil w.updates <- nil
} }
@@ -1281,9 +1283,13 @@ func (kv *kvs) WatchFiltered(ctx context.Context, keys []string, opts ...WatchOp
// Skip if UpdatesOnly() is set, since there will never be updates initially. // Skip if UpdatesOnly() is set, since there will never be updates initially.
if !o.updatesOnly { if !o.updatesOnly {
initialPending, err := sub.InitialConsumerPending() initialPending, err := sub.InitialConsumerPending()
if err == nil && initialPending == 0 { if err == nil {
w.initDone = true if initialPending == 0 {
w.updates <- nil w.initDone = true
w.updates <- nil
} else {
w.initPending = initialPending
}
} }
} else { } else {
// if UpdatesOnly was used, mark initialization as complete // if UpdatesOnly was used, mark initialization as complete
+29 -18
View File
@@ -141,13 +141,21 @@ type (
) )
const ( const (
controlMsg = "100" statusControlMsg = "100"
badRequest = "400" statusBadRequest = "400"
noMessages = "404" statusNoMsgs = "404"
reqTimeout = "408" statusTimeout = "408"
maxBytesExceeded = "409" statusConflict = "409"
noResponders = "503" statusNoResponders = "503"
pinIdMismatch = "423" statusPinIdMismatch = "423"
fcRequestDescr = "flowcontrol request"
idleHeartbeatDescr = "idle heartbeat"
consumerDeleted = "consumer deleted"
leadershipChange = "leadership change"
maxBytesExceeded = "message size exceeds maxbytes"
batchCompleted = "batch completed"
serverShutdown = "server shutdown"
) )
// Headers used when publishing messages. // Headers used when publishing messages.
@@ -411,32 +419,35 @@ func checkMsg(msg *nats.Msg) (bool, error) {
} }
switch val { switch val {
case badRequest: case statusBadRequest:
return false, ErrBadRequest return false, ErrBadRequest
case noResponders: case statusNoResponders:
return false, nats.ErrNoResponders return false, nats.ErrNoResponders
case noMessages: case statusNoMsgs:
// 404 indicates that there are no messages. // 404 indicates that there are no messages.
return false, ErrNoMessages return false, ErrNoMessages
case reqTimeout: case statusTimeout:
return false, nats.ErrTimeout return false, nats.ErrTimeout
case controlMsg: case statusControlMsg:
return false, nil return false, nil
case pinIdMismatch: case statusPinIdMismatch:
return false, ErrPinIDMismatch return false, ErrPinIDMismatch
case maxBytesExceeded: case statusConflict:
if strings.Contains(strings.ToLower(descr), "message size exceeds maxbytes") { if strings.Contains(strings.ToLower(descr), maxBytesExceeded) {
return false, ErrMaxBytesExceeded return false, ErrMaxBytesExceeded
} }
if strings.Contains(strings.ToLower(descr), "batch completed") { if strings.Contains(strings.ToLower(descr), batchCompleted) {
return false, ErrBatchCompleted return false, ErrBatchCompleted
} }
if strings.Contains(strings.ToLower(descr), "consumer deleted") { if strings.Contains(strings.ToLower(descr), consumerDeleted) {
return false, ErrConsumerDeleted return false, ErrConsumerDeleted
} }
if strings.Contains(strings.ToLower(descr), "leadership change") { if strings.Contains(strings.ToLower(descr), leadershipChange) {
return false, ErrConsumerLeadershipChanged return false, ErrConsumerLeadershipChanged
} }
if strings.Contains(strings.ToLower(descr), serverShutdown) {
return false, ErrServerShutdown
}
} }
return false, fmt.Errorf("nats: %s", msg.Header.Get("Description")) return false, fmt.Errorf("nats: %s", msg.Header.Get("Description"))
} }
+24 -17
View File
@@ -39,7 +39,7 @@ type (
consumerType consumerType consumerType consumerType
doReset chan struct{} doReset chan struct{}
resetInProgress atomic.Uint32 resetInProgress atomic.Uint32
userErrHandler ConsumeErrHandlerFunc userErrHandler ConsumeErrHandler
stopAfter int stopAfter int
stopAfterMsgsLeft chan int stopAfterMsgsLeft chan int
withStopAfter bool withStopAfter bool
@@ -80,6 +80,8 @@ var (
// //
// See [Consumer.Consume] for more details. // See [Consumer.Consume] for more details.
func (c *orderedConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt) (ConsumeContext, error) { func (c *orderedConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt) (ConsumeContext, error) {
c.Lock()
defer c.Unlock()
if (c.consumerType == consumerTypeNotSet || c.consumerType == consumerTypeConsume) && c.currentConsumer == nil { if (c.consumerType == consumerTypeNotSet || c.consumerType == consumerTypeConsume) && c.currentConsumer == nil {
err := c.reset() err := c.reset()
if err != nil { if err != nil {
@@ -201,10 +203,20 @@ func (c *orderedConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt
func (c *orderedConsumer) errHandler(serial int) func(cc ConsumeContext, err error) { func (c *orderedConsumer) errHandler(serial int) func(cc ConsumeContext, err error) {
return func(cc ConsumeContext, err error) { return func(cc ConsumeContext, err error) {
c.Lock() c.Lock()
defer c.Unlock()
if c.userErrHandler != nil && !errors.Is(err, errOrderedSequenceMismatch) && !errors.Is(err, errConnected) { if c.userErrHandler != nil && !errors.Is(err, errOrderedSequenceMismatch) && !errors.Is(err, errConnected) {
c.userErrHandler(cc, err) c.userErrHandler(cc, err)
} }
if errors.Is(err, ErrConnectionClosed) {
if c.subscription != nil {
c.Unlock()
c.subscription.Stop()
return
}
c.Unlock()
return
}
if errors.Is(err, ErrNoHeartbeat) || if errors.Is(err, ErrNoHeartbeat) ||
errors.Is(err, errOrderedSequenceMismatch) || errors.Is(err, errOrderedSequenceMismatch) ||
errors.Is(err, ErrConsumerDeleted) || errors.Is(err, ErrConsumerDeleted) ||
@@ -216,6 +228,7 @@ func (c *orderedConsumer) errHandler(serial int) func(cc ConsumeContext, err err
c.doReset <- struct{}{} c.doReset <- struct{}{}
} }
} }
c.Unlock()
} }
} }
@@ -359,29 +372,23 @@ func (s *orderedSubscription) Drain() {
// fully stopped/drained. When the channel is closed, no more messages // fully stopped/drained. When the channel is closed, no more messages
// will be received and processing is complete. // will be received and processing is complete.
func (s *orderedSubscription) Closed() <-chan struct{} { func (s *orderedSubscription) Closed() <-chan struct{} {
s.consumer.Lock()
defer s.consumer.Unlock()
closedCh := make(chan struct{}) closedCh := make(chan struct{})
go func() { go func() {
for { // First wait for s.done to be closed
s.consumer.Lock() <-s.done
if s.consumer.currentSub == nil {
return
}
// Then ensure underlying consumer is also closed (it may still be draining)
s.consumer.Lock()
if s.consumer.currentSub != nil {
closed := s.consumer.currentSub.Closed() closed := s.consumer.currentSub.Closed()
s.consumer.Unlock() s.consumer.Unlock()
// wait until the underlying pull consumer is closed
<-closed <-closed
// if the subscription is closed and ordered consumer is closed as well, } else {
// send a signal that the Consume() is fully stopped s.consumer.Unlock()
if s.closed.Load() == 1 {
close(closedCh)
return
}
} }
close(closedCh)
}() }()
return closedCh return closedCh
} }
+1 -1
View File
@@ -478,7 +478,7 @@ func (js *jetStream) handleAsyncReply(m *nats.Msg) {
} }
// Process no responders etc. // Process no responders etc.
if len(m.Data) == 0 && m.Header.Get(statusHdr) == noResponders { if len(m.Data) == 0 && m.Header.Get(statusHdr) == statusNoResponders {
if paf.retries < paf.maxRetries { if paf.retries < paf.maxRetries {
paf.retries++ paf.retries++
time.AfterFunc(paf.retryWait, func() { time.AfterFunc(paf.retryWait, func() {
+24 -10
View File
@@ -112,7 +112,7 @@ type (
MinAckPending int64 MinAckPending int64
Group string Group string
Heartbeat time.Duration Heartbeat time.Duration
ErrHandler ConsumeErrHandlerFunc ErrHandler ConsumeErrHandler
ReportMissingHeartbeats bool ReportMissingHeartbeats bool
ThresholdMessages int ThresholdMessages int
ThresholdBytes int ThresholdBytes int
@@ -222,7 +222,7 @@ func (p *pullConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt) (
fetchNext: make(chan *pullRequest, 1), fetchNext: make(chan *pullRequest, 1),
consumeOpts: consumeOpts, consumeOpts: consumeOpts,
} }
sub.connStatusChanged = p.js.conn.StatusChanged(nats.CONNECTED, nats.RECONNECTING) sub.connStatusChanged = p.js.conn.StatusChanged(nats.CONNECTED, nats.RECONNECTING, nats.CLOSED)
sub.hbMonitor = sub.scheduleHeartbeatCheck(consumeOpts.Heartbeat) sub.hbMonitor = sub.scheduleHeartbeatCheck(consumeOpts.Heartbeat)
@@ -332,13 +332,13 @@ func (p *pullConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt) (
if !ok { if !ok {
continue continue
} }
if status == nats.RECONNECTING { switch status {
case nats.RECONNECTING:
if sub.hbMonitor != nil { if sub.hbMonitor != nil {
sub.hbMonitor.Stop() sub.hbMonitor.Stop()
} }
isConnected = false isConnected = false
} case nats.CONNECTED:
if status == nats.CONNECTED {
sub.Lock() sub.Lock()
if !isConnected { if !isConnected {
isConnected = true isConnected = true
@@ -362,6 +362,9 @@ func (p *pullConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt) (
sub.resetPendingMsgs() sub.resetPendingMsgs()
} }
sub.Unlock() sub.Unlock()
case nats.CLOSED:
sub.errs <- ErrConnectionClosed
} }
case err := <-sub.errs: case err := <-sub.errs:
sub.Lock() sub.Lock()
@@ -389,6 +392,9 @@ func (p *pullConsumer) Consume(handler MessageHandler, opts ...PullConsumeOpt) (
sub.resetPendingMsgs() sub.resetPendingMsgs()
} }
sub.Unlock() sub.Unlock()
if errors.Is(err, ErrConnectionClosed) {
sub.Stop()
}
case <-sub.done: case <-sub.done:
return return
} }
@@ -569,6 +575,10 @@ func (s *pullSubscription) Next() (Msg, error) {
drainMode := s.draining.Load() == 1 drainMode := s.draining.Load() == 1
closed := s.closed.Load() == 1 closed := s.closed.Load() == 1
if closed && !drainMode { if closed && !drainMode {
// Check if iterator was closed due to connection closure
if s.consumer.js.conn.IsClosed() {
return nil, fmt.Errorf("%w: %w", ErrMsgIteratorClosed, ErrConnectionClosed)
}
return nil, ErrMsgIteratorClosed return nil, ErrMsgIteratorClosed
} }
hbMonitor := s.scheduleHeartbeatCheck(s.consumeOpts.Heartbeat) hbMonitor := s.scheduleHeartbeatCheck(s.consumeOpts.Heartbeat)
@@ -592,6 +602,10 @@ func (s *pullSubscription) Next() (Msg, error) {
// if msgs channel is closed, it means that subscription was either drained or stopped // if msgs channel is closed, it means that subscription was either drained or stopped
s.consumer.subs.Delete(s.id) s.consumer.subs.Delete(s.id)
s.draining.CompareAndSwap(1, 0) s.draining.CompareAndSwap(1, 0)
// Check if iterator was closed due to connection closure
if s.consumer.js.conn.IsClosed() {
return nil, fmt.Errorf("%w: %w", ErrMsgIteratorClosed, ErrConnectionClosed)
}
return nil, ErrMsgIteratorClosed return nil, ErrMsgIteratorClosed
} }
if hbMonitor != nil { if hbMonitor != nil {
@@ -687,15 +701,15 @@ func (s *pullSubscription) handleStatusMsg(msg *nats.Msg, msgErr error) error {
} }
func (hb *hbMonitor) Stop() { func (hb *hbMonitor) Stop() {
hb.Mutex.Lock() hb.Lock()
hb.timer.Stop() hb.timer.Stop()
hb.Mutex.Unlock() hb.Unlock()
} }
func (hb *hbMonitor) Reset(dur time.Duration) { func (hb *hbMonitor) Reset(dur time.Duration) {
hb.Mutex.Lock() hb.Lock()
hb.timer.Reset(dur) hb.timer.Reset(dur)
hb.Mutex.Unlock() hb.Unlock()
} }
// Stop unsubscribes from the stream and cancels subscription. Calling // Stop unsubscribes from the stream and cancels subscription. Calling
@@ -1109,7 +1123,7 @@ func (consumeOpts *consumeOpts) setDefaults(ordered bool) error {
} }
} }
if consumeOpts.Heartbeat > consumeOpts.Expires/2 { if consumeOpts.Heartbeat > consumeOpts.Expires/2 {
return errors.New("the value of Heartbeat must be less than 50%% of expiry") return fmt.Errorf("%w: the value of Heartbeat must be less than 50%% of expiry", ErrInvalidOption)
} }
return nil return nil
} }
+264
View File
@@ -0,0 +1,264 @@
package jetstream
import (
"errors"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/nats-io/nats.go"
"github.com/nats-io/nuid"
)
type (
pushConsumer struct {
sync.Mutex
js *jetStream
stream string
name string
info *ConsumerInfo
started atomic.Bool
}
pushSubscription struct {
sync.Mutex
id string
errs chan error
subscription *nats.Subscription
connStatusChanged chan nats.Status
closedCh chan struct{}
done chan struct{}
closed atomic.Bool
consumeOpts *pushConsumeOpts
hbMonitor *hbMonitor
idleHeartbeat time.Duration
}
pushConsumeOpts struct {
ErrHandler ConsumeErrHandler
}
PushConsumeOpt interface {
configurePushConsume(*pushConsumeOpts) error
}
)
func (p *pushConsumer) Consume(handler MessageHandler, opts ...PushConsumeOpt) (ConsumeContext, error) {
if handler == nil {
return nil, ErrHandlerRequired
}
consumeOpts := &pushConsumeOpts{}
for _, opt := range opts {
if err := opt.configurePushConsume(consumeOpts); err != nil {
return nil, err
}
}
p.Lock()
defer p.Unlock()
if p.info == nil {
return nil, ErrConsumerNotFound
}
if p.started.Load() {
return nil, ErrConsumerAlreadyConsuming
}
consumeID := nuid.Next()
sub := &pushSubscription{
id: consumeID,
errs: make(chan error, 1),
done: make(chan struct{}, 1),
consumeOpts: consumeOpts,
connStatusChanged: p.js.conn.StatusChanged(nats.CONNECTED, nats.RECONNECTING),
idleHeartbeat: p.info.Config.IdleHeartbeat,
}
sub.hbMonitor = sub.scheduleHeartbeatCheck(sub.idleHeartbeat)
internalHandler := func(msg *nats.Msg) {
if sub.hbMonitor != nil {
sub.hbMonitor.Stop()
}
defer func() {
if sub.hbMonitor != nil {
sub.hbMonitor.Reset(2 * sub.idleHeartbeat)
}
}()
status, descr := msg.Header.Get("Status"), msg.Header.Get("Description")
if status == "" {
jsMsg := p.js.toJSMsg(msg)
handler(jsMsg)
return
}
sub.Lock()
if err, terminate := sub.handleStatusMsg(msg, status, descr); err != nil {
if sub.consumeOpts.ErrHandler != nil {
sub.consumeOpts.ErrHandler(sub, err)
}
if terminate {
sub.Stop()
}
}
sub.Unlock()
}
var err error
sub.subscription, err = p.js.conn.Subscribe(p.info.Config.DeliverSubject, internalHandler)
if err != nil {
return nil, err
}
sub.subscription.SetClosedHandler(func(sid string) func(string) {
return func(subject string) {
p.started.Store(false)
sub.Lock()
defer sub.Unlock()
if sub.closedCh != nil {
close(sub.closedCh)
sub.closedCh = nil
}
}
}(sub.id))
go func() {
isConnected := true
for {
if sub.closed.Load() {
return
}
select {
case status, ok := <-sub.connStatusChanged:
if !ok {
continue
}
if status == nats.RECONNECTING {
if sub.hbMonitor != nil {
sub.hbMonitor.Stop()
}
isConnected = false
}
if status == nats.CONNECTED {
sub.Lock()
if !isConnected {
isConnected = true
if sub.hbMonitor != nil {
sub.hbMonitor.Reset(2 * sub.idleHeartbeat)
}
}
sub.Unlock()
}
case err := <-sub.errs:
sub.Lock()
if sub.consumeOpts.ErrHandler != nil {
sub.consumeOpts.ErrHandler(sub, err)
}
if errors.Is(err, ErrNoHeartbeat) {
if sub.hbMonitor != nil {
sub.hbMonitor.Reset(2 * sub.idleHeartbeat)
}
}
sub.Unlock()
case <-sub.done:
return
}
}
}()
p.started.Store(true)
return sub, nil
}
func (s *pushSubscription) handleStatusMsg(msg *nats.Msg, status, description string) (error, bool) {
switch status {
case statusControlMsg:
switch strings.ToLower(description) {
case idleHeartbeatDescr:
return nil, false
case fcRequestDescr:
if err := msg.Respond(nil); err != nil {
if s.consumeOpts.ErrHandler != nil {
s.consumeOpts.ErrHandler(s, err)
}
}
return nil, false
}
case statusConflict:
if description == consumerDeleted {
return ErrConsumerDeleted, true
}
if description == leadershipChange {
if s.consumeOpts.ErrHandler != nil {
s.consumeOpts.ErrHandler(s, ErrConsumerLeadershipChanged)
return ErrConsumerLeadershipChanged, false
}
}
}
return nil, false
}
// Stop unsubscribes from the stream and cancels subscription.
// No more messages will be received after calling this method.
// All messages that are already in the buffer are discarded.
func (s *pushSubscription) Stop() {
if !s.closed.CompareAndSwap(false, true) {
return
}
s.Lock()
defer s.Unlock()
close(s.done)
s.subscription.Unsubscribe()
if s.hbMonitor != nil {
s.hbMonitor.Stop()
}
}
// Drain unsubscribes from the stream and cancels subscription.
// All messages that are already in the buffer will be processed in callback function.
func (s *pushSubscription) Drain() {
if !s.closed.CompareAndSwap(false, true) {
return
}
s.Lock()
defer s.Unlock()
close(s.done)
s.subscription.Drain()
if s.hbMonitor != nil {
s.hbMonitor.Stop()
}
}
// Closed returns a channel that is closed when consuming is
// fully stopped/drained. When the channel is closed, no more messages
// will be received and processing is complete.
func (s *pushSubscription) Closed() <-chan struct{} {
s.Lock()
defer s.Unlock()
ch := s.closedCh
if ch == nil {
ch = make(chan struct{})
s.closedCh = ch
}
if !s.subscription.IsValid() {
close(s.closedCh)
s.closedCh = nil
}
return ch
}
func (s *pushSubscription) scheduleHeartbeatCheck(dur time.Duration) *hbMonitor {
if dur == 0 {
return nil
}
return &hbMonitor{
timer: time.AfterFunc(2*dur, func() {
s.Lock()
defer s.Unlock()
s.errs <- ErrNoHeartbeat
}),
}
}
+63 -8
View File
@@ -67,13 +67,13 @@ type (
// [Consumer] interface, allowing to operate on a consumer (e.g. consume // [Consumer] interface, allowing to operate on a consumer (e.g. consume
// messages). // messages).
ConsumerManager interface { ConsumerManager interface {
// CreateOrUpdateConsumer creates a consumer on a given stream with // CreateOrUpdateConsumer creates a pull consumer on a given stream with
// given config. If consumer already exists, it will be updated (if // given config. If consumer already exists, it will be updated (if
// possible). Consumer interface is returned, allowing to operate on a // possible). Consumer interface is returned, allowing to operate on a
// consumer (e.g. fetch messages). // consumer (e.g. fetch messages).
CreateOrUpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) CreateOrUpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error)
// CreateConsumer creates a consumer on a given stream with given // CreateConsumer creates a pull consumer on a given stream with given
// config. If consumer already exists and the provided configuration // config. If consumer already exists and the provided configuration
// differs from its configuration, ErrConsumerExists is returned. If the // differs from its configuration, ErrConsumerExists is returned. If the
// provided configuration is the same as the existing consumer, the // provided configuration is the same as the existing consumer, the
@@ -81,7 +81,7 @@ type (
// allowing to operate on a consumer (e.g. fetch messages). // allowing to operate on a consumer (e.g. fetch messages).
CreateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) CreateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error)
// UpdateConsumer updates an existing consumer. If consumer does not // UpdateConsumer updates an existing pull consumer. If consumer does not
// exist, ErrConsumerDoesNotExist is returned. Consumer interface is // exist, ErrConsumerDoesNotExist is returned. Consumer interface is
// returned, allowing to operate on a consumer (e.g. fetch messages). // returned, allowing to operate on a consumer (e.g. fetch messages).
UpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) UpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error)
@@ -95,6 +95,8 @@ type (
// Consumer returns an interface to an existing consumer, allowing processing // Consumer returns an interface to an existing consumer, allowing processing
// of messages. If consumer does not exist, ErrConsumerNotFound is // of messages. If consumer does not exist, ErrConsumerNotFound is
// returned. // returned.
//
// It returns ErrNotPullConsumer if the consumer is not a pull consumer (deliver subject is not set).
Consumer(ctx context.Context, consumer string) (Consumer, error) Consumer(ctx context.Context, consumer string) (Consumer, error)
// DeleteConsumer removes a consumer with given name from a stream. // DeleteConsumer removes a consumer with given name from a stream.
@@ -118,6 +120,31 @@ type (
// UnpinConsumer unpins the currently pinned client for a consumer for the given group name. // UnpinConsumer unpins the currently pinned client for a consumer for the given group name.
// If consumer does not exist, ErrConsumerNotFound is returned. // If consumer does not exist, ErrConsumerNotFound is returned.
UnpinConsumer(ctx context.Context, consumer string, group string) error UnpinConsumer(ctx context.Context, consumer string, group string) error
// CreateOrUpdatePushConsumer creates a push consumer on a given stream with
// given config. If consumer already exists, it will be updated (if
// possible). Consumer interface is returned, allowing to consume messages.
CreateOrUpdatePushConsumer(ctx context.Context, cfg ConsumerConfig) (PushConsumer, error)
// CreatePushConsumer creates a push consumer on a given stream with given
// config. If consumer already exists and the provided configuration
// differs from its configuration, ErrConsumerExists is returned. If the
// provided configuration is the same as the existing consumer, the
// existing consumer is returned. Consumer interface is returned,
// allowing to consume messages.
CreatePushConsumer(ctx context.Context, cfg ConsumerConfig) (PushConsumer, error)
// UpdatePushConsumer updates an existing push consumer. If consumer does not
// exist, ErrConsumerDoesNotExist is returned. Consumer interface is
// returned, allowing to consume messages.
UpdatePushConsumer(ctx context.Context, cfg ConsumerConfig) (PushConsumer, error)
// PushConsumer returns an interface to an existing push consumer, allowing processing
// of messages. If consumer does not exist, ErrConsumerNotFound is
// returned.
//
// It returns ErrNotPushConsumer if the consumer is not a push consumer (deliver subject is not set).
PushConsumer(ctx context.Context, consumer string) (PushConsumer, error)
} }
RawStreamMsg struct { RawStreamMsg struct {
@@ -138,7 +165,7 @@ type (
StreamInfoOpt func(*streamInfoRequest) error StreamInfoOpt func(*streamInfoRequest) error
streamInfoRequest struct { streamInfoRequest struct {
apiPaged apiPagedRequest
DeletedDetails bool `json:"deleted_details,omitempty"` DeletedDetails bool `json:"deleted_details,omitempty"`
SubjectFilter string `json:"subjects_filter,omitempty"` SubjectFilter string `json:"subjects_filter,omitempty"`
} }
@@ -273,7 +300,7 @@ type (
// possible). Consumer interface is returned, allowing to operate on a // possible). Consumer interface is returned, allowing to operate on a
// consumer (e.g. fetch messages). // consumer (e.g. fetch messages).
func (s *stream) CreateOrUpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) { func (s *stream) CreateOrUpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) {
return upsertConsumer(ctx, s.js, s.name, cfg, consumerActionCreateOrUpdate) return upsertPullConsumer(ctx, s.js, s.name, cfg, consumerActionCreateOrUpdate)
} }
// CreateConsumer creates a consumer on a given stream with given // CreateConsumer creates a consumer on a given stream with given
@@ -283,14 +310,38 @@ func (s *stream) CreateOrUpdateConsumer(ctx context.Context, cfg ConsumerConfig)
// existing consumer is returned. Consumer interface is returned, // existing consumer is returned. Consumer interface is returned,
// allowing to operate on a consumer (e.g. fetch messages). // allowing to operate on a consumer (e.g. fetch messages).
func (s *stream) CreateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) { func (s *stream) CreateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) {
return upsertConsumer(ctx, s.js, s.name, cfg, consumerActionCreate) return upsertPullConsumer(ctx, s.js, s.name, cfg, consumerActionCreate)
} }
// UpdateConsumer updates an existing consumer. If consumer does not // UpdateConsumer updates an existing consumer. If consumer does not
// exist, ErrConsumerDoesNotExist is returned. Consumer interface is // exist, ErrConsumerDoesNotExist is returned. Consumer interface is
// returned, allowing to operate on a consumer (e.g. fetch messages). // returned, allowing to operate on a consumer (e.g. fetch messages).
func (s *stream) UpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) { func (s *stream) UpdateConsumer(ctx context.Context, cfg ConsumerConfig) (Consumer, error) {
return upsertConsumer(ctx, s.js, s.name, cfg, consumerActionUpdate) return upsertPullConsumer(ctx, s.js, s.name, cfg, consumerActionUpdate)
}
// CreateOrUpdatePushConsumer creates a consumer on a given stream with
// given config. If consumer already exists, it will be updated (if
// possible). Consumer interface is returned, allowing to consume messages.
func (s *stream) CreateOrUpdatePushConsumer(ctx context.Context, cfg ConsumerConfig) (PushConsumer, error) {
return upsertPushConsumer(ctx, s.js, s.name, cfg, consumerActionCreateOrUpdate)
}
// CreatePushConsumer creates a consumer on a given stream with given
// config. If consumer already exists and the provided configuration
// differs from its configuration, ErrConsumerExists is returned. If the
// provided configuration is the same as the existing consumer, the
// existing consumer is returned. Consumer interface is returned,
// allowing to consume messages.
func (s *stream) CreatePushConsumer(ctx context.Context, cfg ConsumerConfig) (PushConsumer, error) {
return upsertPushConsumer(ctx, s.js, s.name, cfg, consumerActionCreate)
}
// UpdatePushConsumer updates an existing consumer. If consumer does not
// exist, ErrConsumerDoesNotExist is returned. Consumer interface is
// returned, allowing to consume messages.
func (s *stream) UpdatePushConsumer(ctx context.Context, cfg ConsumerConfig) (PushConsumer, error) {
return upsertPushConsumer(ctx, s.js, s.name, cfg, consumerActionUpdate)
} }
// OrderedConsumer returns an OrderedConsumer instance. OrderedConsumer // OrderedConsumer returns an OrderedConsumer instance. OrderedConsumer
@@ -322,6 +373,10 @@ func (s *stream) Consumer(ctx context.Context, name string) (Consumer, error) {
return getConsumer(ctx, s.js, s.name, name) return getConsumer(ctx, s.js, s.name, name)
} }
func (s *stream) PushConsumer(ctx context.Context, name string) (PushConsumer, error) {
return getPushConsumer(ctx, s.js, s.name, name)
}
// DeleteConsumer removes a consumer with given name from a stream. // DeleteConsumer removes a consumer with given name from a stream.
// If consumer does not exist, ErrConsumerNotFound is returned. // If consumer does not exist, ErrConsumerNotFound is returned.
func (s *stream) DeleteConsumer(ctx context.Context, name string) error { func (s *stream) DeleteConsumer(ctx context.Context, name string) error {
@@ -532,7 +587,7 @@ func convertDirectGetMsgResponseToMsg(r *nats.Msg) (*RawStreamMsg, error) {
val := r.Header.Get(statusHdr) val := r.Header.Get(statusHdr)
if val != "" { if val != "" {
switch val { switch val {
case noMessages: case statusNoMsgs:
return nil, ErrMsgNotFound return nil, ErrMsgNotFound
default: default:
desc := r.Header.Get("Description") desc := r.Header.Get("Description")
+6 -1
View File
@@ -1778,6 +1778,11 @@ func getJSContextOpts(defs *jsOpts, opts ...JSOpt) (*jsOpts, context.CancelFunc,
if o.pre == _EMPTY_ { if o.pre == _EMPTY_ {
o.pre = defs.pre o.pre = defs.pre
} }
if o.ctx != nil {
// if context does not have a deadline, use timeout from js context
if _, hasDeadline := o.ctx.Deadline(); !hasDeadline {
o.ctx, cancel = context.WithTimeout(o.ctx, defs.wait)
}
}
return &o, cancel, nil return &o, cancel, nil
} }
+55 -19
View File
@@ -115,12 +115,22 @@ type KeyWatcher interface {
Updates() <-chan KeyValueEntry Updates() <-chan KeyValueEntry
// Stop will stop this watcher. // Stop will stop this watcher.
Stop() error Stop() error
// Error returns a channel that will receive any error that occurs during
// watching. In particular, this will receive an error if the watcher times
// out while expecting more initial keys. The channel is closed when the
// watch operation completes or when Stop() is called.
Error() <-chan error
} }
// KeyLister is used to retrieve a list of key value store keys // KeyLister is used to retrieve a list of key value store keys
type KeyLister interface { type KeyLister interface {
Keys() <-chan string Keys() <-chan string
Stop() error Stop() error
// Error returns a channel that will receive any error that occurs during
// key listing. In particular, this will receive an error if the underlying
// watcher times out while expecting more keys. The channel is closed when
// the listing operation completes or when Stop() is called.
Error() <-chan error
} }
type WatchOpt interface { type WatchOpt interface {
@@ -331,6 +341,7 @@ var (
ErrKeyDeleted = errors.New("nats: key was deleted") ErrKeyDeleted = errors.New("nats: key was deleted")
ErrHistoryToLarge = errors.New("nats: history limited to a max of 64") ErrHistoryToLarge = errors.New("nats: history limited to a max of 64")
ErrNoKeysFound = errors.New("nats: no keys found") ErrNoKeysFound = errors.New("nats: no keys found")
ErrKeyWatcherTimeout = errors.New("nats: key watcher timed out waiting for initial keys")
) )
var ( var (
@@ -911,6 +922,10 @@ func (kl *keyLister) Stop() error {
return kl.watcher.Stop() return kl.watcher.Stop()
} }
func (kl *keyLister) Error() <-chan error {
return kl.watcher.Error()
}
// History will return all values for the key. // History will return all values for the key.
func (kv *kvs) History(key string, opts ...WatchOpt) ([]KeyValueEntry, error) { func (kv *kvs) History(key string, opts ...WatchOpt) ([]KeyValueEntry, error) {
opts = append(opts, IncludeHistory()) opts = append(opts, IncludeHistory())
@@ -943,6 +958,7 @@ type watcher struct {
received uint64 received uint64
ctx context.Context ctx context.Context
initDoneTimer *time.Timer initDoneTimer *time.Timer
errCh chan error
} }
// Context returns the context for the watcher if set. // Context returns the context for the watcher if set.
@@ -969,6 +985,16 @@ func (w *watcher) Stop() error {
return w.sub.Unsubscribe() return w.sub.Unsubscribe()
} }
// Error returns a channel that will receive any error that occurs during watching.
func (w *watcher) Error() <-chan error {
if w == nil {
closedCh := make(chan error)
close(closedCh)
return closedCh
}
return w.errCh
}
// WatchAll watches all keys. // WatchAll watches all keys.
func (kv *kvs) WatchAll(opts ...WatchOpt) (KeyWatcher, error) { func (kv *kvs) WatchAll(opts ...WatchOpt) (KeyWatcher, error) {
return kv.Watch(AllKeys, opts...) return kv.Watch(AllKeys, opts...)
@@ -1006,7 +1032,11 @@ func (kv *kvs) WatchFiltered(keys []string, opts ...WatchOpt) (KeyWatcher, error
} }
// We will block below on placing items on the chan. That is by design. // We will block below on placing items on the chan. That is by design.
w := &watcher{updates: make(chan KeyValueEntry, 256), ctx: o.ctx} w := &watcher{
updates: make(chan KeyValueEntry, 256),
ctx: o.ctx,
errCh: make(chan error, 1),
}
update := func(m *Msg) { update := func(m *Msg) {
tokens, err := parser.GetMetadataFields(m.Reply) tokens, err := parser.GetMetadataFields(m.Reply)
@@ -1046,11 +1076,9 @@ func (kv *kvs) WatchFiltered(keys []string, opts ...WatchOpt) (KeyWatcher, error
// Skip if UpdatesOnly() is set, since there will never be updates initially. // Skip if UpdatesOnly() is set, since there will never be updates initially.
if !w.initDone { if !w.initDone {
w.received++ w.received++
// We set this on the first trip through.. // Use the stable initPending value set at consumer creation.
if w.initPending == 0 { // We're done if we've received all expected messages OR there are no more pending
w.initPending = delta if w.received >= w.initPending || delta == 0 {
}
if w.received > w.initPending || delta == 0 {
// Avoid possible race setting up timer. // Avoid possible race setting up timer.
if w.initDoneTimer != nil { if w.initDoneTimer != nil {
w.initDoneTimer.Stop() w.initDoneTimer.Stop()
@@ -1098,19 +1126,26 @@ func (kv *kvs) WatchFiltered(keys []string, opts ...WatchOpt) (KeyWatcher, error
// of the consumer, send the marker. // of the consumer, send the marker.
// Skip if UpdatesOnly() is set, since there will never be updates initially. // Skip if UpdatesOnly() is set, since there will never be updates initially.
if !o.updatesOnly { if !o.updatesOnly {
if sub.jsi != nil && sub.jsi.pending == 0 { if sub.jsi != nil {
w.initDone = true if sub.jsi.pending == 0 {
w.updates <- nil w.initDone = true
} else { w.updates <- nil
// Set a timer to send the marker if we do not get any messages. } else {
w.initDoneTimer = time.AfterFunc(kv.js.opts.wait, func() { w.initPending = sub.jsi.pending
w.mu.Lock() // Set a timer to send the marker if we do not get any messages.
defer w.mu.Unlock() w.initDoneTimer = time.AfterFunc(kv.js.opts.wait, func() {
if !w.initDone { w.mu.Lock()
w.initDone = true defer w.mu.Unlock()
w.updates <- nil if !w.initDone {
} w.initDone = true
}) select {
case w.errCh <- ErrKeyWatcherTimeout:
default:
}
w.updates <- nil
}
})
}
} }
} else { } else {
// if UpdatesOnly was used, mark initialization as complete // if UpdatesOnly was used, mark initialization as complete
@@ -1124,6 +1159,7 @@ func (kv *kvs) WatchFiltered(keys []string, opts ...WatchOpt) (KeyWatcher, error
w.initDoneTimer.Stop() w.initDoneTimer.Stop()
} }
close(w.updates) close(w.updates)
close(w.errCh)
} }
sub.mu.Unlock() sub.mu.Unlock()
+47 -11
View File
@@ -47,7 +47,7 @@ import (
// Default Constants // Default Constants
const ( const (
Version = "1.43.0" Version = "1.44.0"
DefaultURL = "nats://127.0.0.1:4222" DefaultURL = "nats://127.0.0.1:4222"
DefaultPort = 4222 DefaultPort = 4222
DefaultMaxReconnect = 60 DefaultMaxReconnect = 60
@@ -1247,6 +1247,35 @@ func UserCredentials(userOrChainedFile string, seedFiles ...string) Option {
return UserJWT(userCB, sigCB) return UserJWT(userCB, sigCB)
} }
// UserCredentialBytes is a convenience function that takes the JWT and seed
// values as byte slices. This allows passing credentials directly from memory
// or environment variables without needing to write them to disk.
func UserCredentialBytes(userOrChainedFileBytes []byte, seedFiles ...[]byte) Option {
userCB := func() (string, error) {
return nkeys.ParseDecoratedJWT(userOrChainedFileBytes)
}
var seedBytes []byte
if len(seedFiles) > 0 {
seedBytes = seedFiles[0]
} else {
seedBytes = userOrChainedFileBytes
}
sigCB := func(nonce []byte) ([]byte, error) {
kp, err := nkeys.ParseDecoratedNKey(seedBytes)
if err != nil {
return nil, fmt.Errorf("unable to extract key pair from bytes: %w", err)
}
defer kp.Wipe()
sig, _ := kp.Sign(nonce)
return sig, nil
}
return UserJWT(userCB, sigCB)
}
// UserJWTAndSeed is a convenience function that takes the JWT and seed // UserJWTAndSeed is a convenience function that takes the JWT and seed
// values as strings. // values as strings.
func UserJWTAndSeed(jwt string, seed string) Option { func UserJWTAndSeed(jwt string, seed string) Option {
@@ -5158,8 +5187,8 @@ func (s *Subscription) ClearMaxPending() error {
// Pending Limits // Pending Limits
const ( const (
// DefaultSubPendingMsgsLimit will be 512k msgs. // DefaultSubPendingMsgsLimit will be 500k msgs.
DefaultSubPendingMsgsLimit = 512 * 1024 DefaultSubPendingMsgsLimit = 500_000
// DefaultSubPendingBytesLimit is 64MB // DefaultSubPendingBytesLimit is 64MB
DefaultSubPendingBytesLimit = 64 * 1024 * 1024 DefaultSubPendingBytesLimit = 64 * 1024 * 1024
) )
@@ -5509,6 +5538,14 @@ func (nc *Conn) close(status Status, doCBs bool, err error) {
close(s.mch) close(s.mch)
} }
s.mch = nil s.mch = nil
// Call closed handler for non-AsyncSubscription types (AsyncSubscription handlers
// are called by waitForMsgs when it exits)
var done func(string)
if s.typ != AsyncSubscription && s.pDone != nil {
done = s.pDone
}
// Mark as invalid, for signaling to waitForMsgs // Mark as invalid, for signaling to waitForMsgs
s.closed = true s.closed = true
// Mark connection closed in subscription // Mark connection closed in subscription
@@ -5519,6 +5556,11 @@ func (nc *Conn) close(status Status, doCBs bool, err error) {
} }
s.mu.Unlock() s.mu.Unlock()
// Call the closed handler outside the lock to avoid potential deadlocks
if done != nil {
done(s.Subject)
}
} }
nc.subs = nil nc.subs = nil
nc.subsMu.Unlock() nc.subsMu.Unlock()
@@ -6107,18 +6149,12 @@ func sigHandler(nonce []byte, seedFile string) ([]byte, error) {
type timeoutWriter struct { type timeoutWriter struct {
timeout time.Duration timeout time.Duration
conn net.Conn conn net.Conn
err error
} }
// Write implements the io.Writer interface. // Write implements the io.Writer interface.
func (tw *timeoutWriter) Write(p []byte) (int, error) { func (tw *timeoutWriter) Write(p []byte) (int, error) {
if tw.err != nil {
return 0, tw.err
}
var n int
tw.conn.SetWriteDeadline(time.Now().Add(tw.timeout)) tw.conn.SetWriteDeadline(time.Now().Add(tw.timeout))
n, tw.err = tw.conn.Write(p) n, err := tw.conn.Write(p)
tw.conn.SetWriteDeadline(time.Time{}) tw.conn.SetWriteDeadline(time.Time{})
return n, tw.err return n, err
} }
@@ -19,6 +19,7 @@
package eventsmiddleware package eventsmiddleware
import ( import (
"strings"
"time" "time"
group "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1" group "github.com/cs3org/go-cs3apis/cs3/identity/group/v1beta1"
@@ -28,6 +29,7 @@ import (
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/opencloud-eu/reva/v2/pkg/events" "github.com/opencloud-eu/reva/v2/pkg/events"
"github.com/opencloud-eu/reva/v2/pkg/rhttp/router"
"github.com/opencloud-eu/reva/v2/pkg/storagespace" "github.com/opencloud-eu/reva/v2/pkg/storagespace"
"github.com/opencloud-eu/reva/v2/pkg/utils" "github.com/opencloud-eu/reva/v2/pkg/utils"
) )
@@ -293,11 +295,45 @@ func ItemMoved(r *provider.MoveResponse, req *provider.MoveRequest, spaceOwner *
} }
} }
// TrashbinPurged converts the response to an event
func TrashbinPurged(r *provider.PurgeRecycleResponse, req *provider.PurgeRecycleRequest, executant *user.User) events.TrashbinPurged {
return events.TrashbinPurged{
Executant: executant.GetId(),
Ref: &provider.Reference{
ResourceId: &provider.ResourceId{
StorageId: req.Ref.GetResourceId().GetStorageId(),
SpaceId: req.Ref.GetResourceId().GetSpaceId(),
OpaqueId: req.Ref.GetResourceId().GetSpaceId(),
},
},
Timestamp: utils.TSNow(),
ImpersonatingUser: extractImpersonator(executant),
}
}
// ItemPurged converts the response to an event // ItemPurged converts the response to an event
func ItemPurged(r *provider.PurgeRecycleResponse, req *provider.PurgeRecycleRequest, executant *user.User) events.ItemPurged { func ItemPurged(r *provider.PurgeRecycleResponse, req *provider.PurgeRecycleRequest, executant *user.User) events.ItemPurged {
root, relativePath := router.ShiftPath(req.Key)
if relativePath == "/" && !strings.HasSuffix(req.Key, "/") {
relativePath = ""
}
if root == "" {
// if there is no key this is about purging the whole trashbin
root = req.Ref.GetResourceId().GetSpaceId()
}
ref := &provider.Reference{
ResourceId: &provider.ResourceId{
StorageId: req.Ref.GetResourceId().GetStorageId(),
SpaceId: req.Ref.GetResourceId().GetSpaceId(),
OpaqueId: root,
},
Path: relativePath,
}
return events.ItemPurged{ return events.ItemPurged{
Executant: executant.GetId(), Executant: executant.GetId(),
Ref: req.Ref, Ref: ref,
Timestamp: utils.TSNow(), Timestamp: utils.TSNow(),
ImpersonatingUser: extractImpersonator(executant), ImpersonatingUser: extractImpersonator(executant),
} }
@@ -149,7 +149,13 @@ func NewUnary(m map[string]interface{}) (grpc.UnaryServerInterceptor, int, error
} }
case *provider.PurgeRecycleResponse: case *provider.PurgeRecycleResponse:
if isSuccess(v) { if isSuccess(v) {
ev = ItemPurged(v, req.(*provider.PurgeRecycleRequest), executant) id := req.(*provider.PurgeRecycleRequest).GetRef().GetResourceId()
if id != nil && id.OpaqueId == id.SpaceId && req.(*provider.PurgeRecycleRequest).Key == "" {
// this is a purge of the whole trashbin, NOT the whole space
ev = TrashbinPurged(v, req.(*provider.PurgeRecycleRequest), executant)
} else {
ev = ItemPurged(v, req.(*provider.PurgeRecycleRequest), executant)
}
} }
case *provider.RestoreRecycleItemResponse: case *provider.RestoreRecycleItemResponse:
if isSuccess(v) { if isSuccess(v) {
+16
View File
@@ -162,6 +162,22 @@ func (ItemMoved) Unmarshal(v []byte) (interface{}, error) {
return e, err return e, err
} }
// TrashbinPurged is emitted when the whole trashbin is purged
type TrashbinPurged struct {
Executant *user.UserId
Ref *provider.Reference
Owner *user.UserId
Timestamp *types.Timestamp
ImpersonatingUser *user.User
}
// Unmarshal to fulfill umarshaller interface
func (TrashbinPurged) Unmarshal(v []byte) (interface{}, error) {
e := TrashbinPurged{}
err := json.Unmarshal(v, &e)
return e, err
}
// ItemPurged is emitted when a file or folder is removed from trashbin // ItemPurged is emitted when a file or folder is removed from trashbin
type ItemPurged struct { type ItemPurged struct {
Executant *user.UserId Executant *user.UserId
+1 -1
View File
@@ -26,7 +26,7 @@ import (
var ( var (
// MinClusterVersion is the min cluster version this etcd binary is compatible with. // MinClusterVersion is the min cluster version this etcd binary is compatible with.
MinClusterVersion = "3.0.0" MinClusterVersion = "3.0.0"
Version = "3.6.2" Version = "3.6.4"
APIVersion = "unknown" APIVersion = "unknown"
// Git SHA Value will be set during build // Git SHA Value will be set during build
+3
View File
@@ -349,6 +349,9 @@ struct ltchars {
#define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN) #define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN)
#define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN) #define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN)
// Renamed in v6.16, commit c6d732c38f93 ("net: ethtool: remove duplicate defines for family info")
#define ETHTOOL_FAMILY_NAME ETHTOOL_GENL_NAME
#define ETHTOOL_FAMILY_VERSION ETHTOOL_GENL_VERSION
' '
includes_NetBSD=' includes_NetBSD='
+1 -55
View File
@@ -602,14 +602,9 @@ func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocI
return return
} }
// sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error)
const minIovec = 8 const minIovec = 8
func Readv(fd int, iovs [][]byte) (n int, err error) { func Readv(fd int, iovs [][]byte) (n int, err error) {
if !darwinKernelVersionMin(11, 0, 0) {
return 0, ENOSYS
}
iovecs := make([]Iovec, 0, minIovec) iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs) iovecs = appendBytes(iovecs, iovs)
n, err = readv(fd, iovecs) n, err = readv(fd, iovecs)
@@ -618,9 +613,6 @@ func Readv(fd int, iovs [][]byte) (n int, err error) {
} }
func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) { func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) {
if !darwinKernelVersionMin(11, 0, 0) {
return 0, ENOSYS
}
iovecs := make([]Iovec, 0, minIovec) iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs) iovecs = appendBytes(iovecs, iovs)
n, err = preadv(fd, iovecs, offset) n, err = preadv(fd, iovecs, offset)
@@ -629,10 +621,6 @@ func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) {
} }
func Writev(fd int, iovs [][]byte) (n int, err error) { func Writev(fd int, iovs [][]byte) (n int, err error) {
if !darwinKernelVersionMin(11, 0, 0) {
return 0, ENOSYS
}
iovecs := make([]Iovec, 0, minIovec) iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs) iovecs = appendBytes(iovecs, iovs)
if raceenabled { if raceenabled {
@@ -644,10 +632,6 @@ func Writev(fd int, iovs [][]byte) (n int, err error) {
} }
func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) { func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) {
if !darwinKernelVersionMin(11, 0, 0) {
return 0, ENOSYS
}
iovecs := make([]Iovec, 0, minIovec) iovecs := make([]Iovec, 0, minIovec)
iovecs = appendBytes(iovecs, iovs) iovecs = appendBytes(iovecs, iovs)
if raceenabled { if raceenabled {
@@ -707,45 +691,7 @@ func readvRacedetect(iovecs []Iovec, n int, err error) {
} }
} }
func darwinMajorMinPatch() (maj, min, patch int, err error) { //sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error)
var un Utsname
err = Uname(&un)
if err != nil {
return
}
var mmp [3]int
c := 0
Loop:
for _, b := range un.Release[:] {
switch {
case b >= '0' && b <= '9':
mmp[c] = 10*mmp[c] + int(b-'0')
case b == '.':
c++
if c > 2 {
return 0, 0, 0, ENOTSUP
}
case b == 0:
break Loop
default:
return 0, 0, 0, ENOTSUP
}
}
if c != 2 {
return 0, 0, 0, ENOTSUP
}
return mmp[0], mmp[1], mmp[2], nil
}
func darwinKernelVersionMin(maj, min, patch int) bool {
actualMaj, actualMin, actualPatch, err := darwinMajorMinPatch()
if err != nil {
return false
}
return actualMaj > maj || actualMaj == maj && (actualMin > min || actualMin == min && actualPatch >= patch)
}
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) //sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
+30 -14
View File
@@ -328,6 +328,8 @@ const (
AUDIT_KERNEL = 0x7d0 AUDIT_KERNEL = 0x7d0
AUDIT_KERNEL_OTHER = 0x524 AUDIT_KERNEL_OTHER = 0x524
AUDIT_KERN_MODULE = 0x532 AUDIT_KERN_MODULE = 0x532
AUDIT_LANDLOCK_ACCESS = 0x58f
AUDIT_LANDLOCK_DOMAIN = 0x590
AUDIT_LAST_FEATURE = 0x1 AUDIT_LAST_FEATURE = 0x1
AUDIT_LAST_KERN_ANOM_MSG = 0x707 AUDIT_LAST_KERN_ANOM_MSG = 0x707
AUDIT_LAST_USER_MSG = 0x4af AUDIT_LAST_USER_MSG = 0x4af
@@ -492,6 +494,7 @@ const (
BPF_F_BEFORE = 0x8 BPF_F_BEFORE = 0x8
BPF_F_ID = 0x20 BPF_F_ID = 0x20
BPF_F_NETFILTER_IP_DEFRAG = 0x1 BPF_F_NETFILTER_IP_DEFRAG = 0x1
BPF_F_PREORDER = 0x40
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_REDIRECT_FLAGS = 0x19 BPF_F_REDIRECT_FLAGS = 0x19
BPF_F_REPLACE = 0x4 BPF_F_REPLACE = 0x4
@@ -528,6 +531,7 @@ const (
BPF_LDX = 0x1 BPF_LDX = 0x1
BPF_LEN = 0x80 BPF_LEN = 0x80
BPF_LL_OFF = -0x200000 BPF_LL_OFF = -0x200000
BPF_LOAD_ACQ = 0x100
BPF_LSH = 0x60 BPF_LSH = 0x60
BPF_MAJOR_VERSION = 0x1 BPF_MAJOR_VERSION = 0x1
BPF_MAXINSNS = 0x1000 BPF_MAXINSNS = 0x1000
@@ -555,6 +559,7 @@ const (
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_ST = 0x2 BPF_ST = 0x2
BPF_STORE_REL = 0x110
BPF_STX = 0x3 BPF_STX = 0x3
BPF_SUB = 0x10 BPF_SUB = 0x10
BPF_TAG_SIZE = 0x8 BPF_TAG_SIZE = 0x8
@@ -844,9 +849,9 @@ const (
DM_UUID_FLAG = 0x4000 DM_UUID_FLAG = 0x4000
DM_UUID_LEN = 0x81 DM_UUID_LEN = 0x81
DM_VERSION = 0xc138fd00 DM_VERSION = 0xc138fd00
DM_VERSION_EXTRA = "-ioctl (2025-01-17)" DM_VERSION_EXTRA = "-ioctl (2025-04-28)"
DM_VERSION_MAJOR = 0x4 DM_VERSION_MAJOR = 0x4
DM_VERSION_MINOR = 0x31 DM_VERSION_MINOR = 0x32
DM_VERSION_PATCHLEVEL = 0x0 DM_VERSION_PATCHLEVEL = 0x0
DT_BLK = 0x6 DT_BLK = 0x6
DT_CHR = 0x2 DT_CHR = 0x2
@@ -937,9 +942,6 @@ const (
EPOLL_CTL_MOD = 0x3 EPOLL_CTL_MOD = 0x3
EPOLL_IOC_TYPE = 0x8a EPOLL_IOC_TYPE = 0x8a
EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2
ESP_V4_FLOW = 0xa
ESP_V6_FLOW = 0xc
ETHER_FLOW = 0x12
ETHTOOL_BUSINFO_LEN = 0x20 ETHTOOL_BUSINFO_LEN = 0x20
ETHTOOL_EROMVERS_LEN = 0x20 ETHTOOL_EROMVERS_LEN = 0x20
ETHTOOL_FAMILY_NAME = "ethtool" ETHTOOL_FAMILY_NAME = "ethtool"
@@ -1213,6 +1215,7 @@ const (
FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2 FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2
FAN_EVENT_INFO_TYPE_ERROR = 0x5 FAN_EVENT_INFO_TYPE_ERROR = 0x5
FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_INFO_TYPE_FID = 0x1
FAN_EVENT_INFO_TYPE_MNT = 0x7
FAN_EVENT_INFO_TYPE_NEW_DFID_NAME = 0xc FAN_EVENT_INFO_TYPE_NEW_DFID_NAME = 0xc
FAN_EVENT_INFO_TYPE_OLD_DFID_NAME = 0xa FAN_EVENT_INFO_TYPE_OLD_DFID_NAME = 0xa
FAN_EVENT_INFO_TYPE_PIDFD = 0x4 FAN_EVENT_INFO_TYPE_PIDFD = 0x4
@@ -1231,9 +1234,12 @@ const (
FAN_MARK_IGNORED_SURV_MODIFY = 0x40 FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_IGNORE_SURV = 0x440 FAN_MARK_IGNORE_SURV = 0x440
FAN_MARK_INODE = 0x0 FAN_MARK_INODE = 0x0
FAN_MARK_MNTNS = 0x110
FAN_MARK_MOUNT = 0x10 FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8 FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2 FAN_MARK_REMOVE = 0x2
FAN_MNT_ATTACH = 0x1000000
FAN_MNT_DETACH = 0x2000000
FAN_MODIFY = 0x2 FAN_MODIFY = 0x2
FAN_MOVE = 0xc0 FAN_MOVE = 0xc0
FAN_MOVED_FROM = 0x40 FAN_MOVED_FROM = 0x40
@@ -1255,6 +1261,7 @@ const (
FAN_REPORT_DIR_FID = 0x400 FAN_REPORT_DIR_FID = 0x400
FAN_REPORT_FD_ERROR = 0x2000 FAN_REPORT_FD_ERROR = 0x2000
FAN_REPORT_FID = 0x200 FAN_REPORT_FID = 0x200
FAN_REPORT_MNT = 0x4000
FAN_REPORT_NAME = 0x800 FAN_REPORT_NAME = 0x800
FAN_REPORT_PIDFD = 0x80 FAN_REPORT_PIDFD = 0x80
FAN_REPORT_TARGET_FID = 0x1000 FAN_REPORT_TARGET_FID = 0x1000
@@ -1274,6 +1281,7 @@ const (
FIB_RULE_PERMANENT = 0x1 FIB_RULE_PERMANENT = 0x1
FIB_RULE_UNRESOLVED = 0x4 FIB_RULE_UNRESOLVED = 0x4
FIDEDUPERANGE = 0xc0189436 FIDEDUPERANGE = 0xc0189436
FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED = 0x1
FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8 FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8
FSCRYPT_KEY_DESC_PREFIX = "fscrypt:" FSCRYPT_KEY_DESC_PREFIX = "fscrypt:"
FSCRYPT_KEY_DESC_PREFIX_SIZE = 0x8 FSCRYPT_KEY_DESC_PREFIX_SIZE = 0x8
@@ -1582,7 +1590,6 @@ const (
IPV6_DONTFRAG = 0x3e IPV6_DONTFRAG = 0x3e
IPV6_DROP_MEMBERSHIP = 0x15 IPV6_DROP_MEMBERSHIP = 0x15
IPV6_DSTOPTS = 0x3b IPV6_DSTOPTS = 0x3b
IPV6_FLOW = 0x11
IPV6_FREEBIND = 0x4e IPV6_FREEBIND = 0x4e
IPV6_HDRINCL = 0x24 IPV6_HDRINCL = 0x24
IPV6_HOPLIMIT = 0x34 IPV6_HOPLIMIT = 0x34
@@ -1633,7 +1640,6 @@ const (
IPV6_TRANSPARENT = 0x4b IPV6_TRANSPARENT = 0x4b
IPV6_UNICAST_HOPS = 0x10 IPV6_UNICAST_HOPS = 0x10
IPV6_UNICAST_IF = 0x4c IPV6_UNICAST_IF = 0x4c
IPV6_USER_FLOW = 0xe
IPV6_V6ONLY = 0x1a IPV6_V6ONLY = 0x1a
IPV6_VERSION = 0x60 IPV6_VERSION = 0x60
IPV6_VERSION_MASK = 0xf0 IPV6_VERSION_MASK = 0xf0
@@ -1695,7 +1701,6 @@ const (
IP_TTL = 0x2 IP_TTL = 0x2
IP_UNBLOCK_SOURCE = 0x25 IP_UNBLOCK_SOURCE = 0x25
IP_UNICAST_IF = 0x32 IP_UNICAST_IF = 0x32
IP_USER_FLOW = 0xd
IP_XFRM_POLICY = 0x11 IP_XFRM_POLICY = 0x11
ISOFS_SUPER_MAGIC = 0x9660 ISOFS_SUPER_MAGIC = 0x9660
ISTRIP = 0x20 ISTRIP = 0x20
@@ -1817,7 +1822,11 @@ const (
LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2
LANDLOCK_ACCESS_NET_BIND_TCP = 0x1 LANDLOCK_ACCESS_NET_BIND_TCP = 0x1
LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2 LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2
LANDLOCK_CREATE_RULESET_ERRATA = 0x2
LANDLOCK_CREATE_RULESET_VERSION = 0x1 LANDLOCK_CREATE_RULESET_VERSION = 0x1
LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON = 0x2
LANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFF = 0x1
LANDLOCK_RESTRICT_SELF_LOG_SUBDOMAINS_OFF = 0x4
LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET = 0x1 LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET = 0x1
LANDLOCK_SCOPE_SIGNAL = 0x2 LANDLOCK_SCOPE_SIGNAL = 0x2
LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_OFF = 0x0
@@ -2493,6 +2502,10 @@ const (
PR_FP_EXC_UND = 0x40000 PR_FP_EXC_UND = 0x40000
PR_FP_MODE_FR = 0x1 PR_FP_MODE_FR = 0x1
PR_FP_MODE_FRE = 0x2 PR_FP_MODE_FRE = 0x2
PR_FUTEX_HASH = 0x4e
PR_FUTEX_HASH_GET_IMMUTABLE = 0x3
PR_FUTEX_HASH_GET_SLOTS = 0x2
PR_FUTEX_HASH_SET_SLOTS = 0x1
PR_GET_AUXV = 0x41555856 PR_GET_AUXV = 0x41555856
PR_GET_CHILD_SUBREAPER = 0x25 PR_GET_CHILD_SUBREAPER = 0x25
PR_GET_DUMPABLE = 0x3 PR_GET_DUMPABLE = 0x3
@@ -2652,6 +2665,10 @@ const (
PR_TAGGED_ADDR_ENABLE = 0x1 PR_TAGGED_ADDR_ENABLE = 0x1
PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_DISABLE = 0x1f
PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TASK_PERF_EVENTS_ENABLE = 0x20
PR_TIMER_CREATE_RESTORE_IDS = 0x4d
PR_TIMER_CREATE_RESTORE_IDS_GET = 0x2
PR_TIMER_CREATE_RESTORE_IDS_OFF = 0x0
PR_TIMER_CREATE_RESTORE_IDS_ON = 0x1
PR_TIMING_STATISTICAL = 0x0 PR_TIMING_STATISTICAL = 0x0
PR_TIMING_TIMESTAMP = 0x1 PR_TIMING_TIMESTAMP = 0x1
PR_TSC_ENABLE = 0x1 PR_TSC_ENABLE = 0x1
@@ -2732,6 +2749,7 @@ const (
PTRACE_SETREGSET = 0x4205 PTRACE_SETREGSET = 0x4205
PTRACE_SETSIGINFO = 0x4203 PTRACE_SETSIGINFO = 0x4203
PTRACE_SETSIGMASK = 0x420b PTRACE_SETSIGMASK = 0x420b
PTRACE_SET_SYSCALL_INFO = 0x4212
PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG = 0x4210 PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG = 0x4210
PTRACE_SINGLESTEP = 0x9 PTRACE_SINGLESTEP = 0x9
PTRACE_SYSCALL = 0x18 PTRACE_SYSCALL = 0x18
@@ -2982,6 +3000,7 @@ const (
RTPROT_NTK = 0xf RTPROT_NTK = 0xf
RTPROT_OPENR = 0x63 RTPROT_OPENR = 0x63
RTPROT_OSPF = 0xbc RTPROT_OSPF = 0xbc
RTPROT_OVN = 0x54
RTPROT_RA = 0x9 RTPROT_RA = 0x9
RTPROT_REDIRECT = 0x1 RTPROT_REDIRECT = 0x1
RTPROT_RIP = 0xbd RTPROT_RIP = 0xbd
@@ -3336,7 +3355,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6 TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0xf TASKSTATS_VERSION = 0x10
TCIFLUSH = 0x0 TCIFLUSH = 0x0
TCIOFF = 0x2 TCIOFF = 0x2
TCIOFLUSH = 0x2 TCIOFLUSH = 0x2
@@ -3406,8 +3425,6 @@ const (
TCP_TX_DELAY = 0x25 TCP_TX_DELAY = 0x25
TCP_ULP = 0x1f TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12 TCP_USER_TIMEOUT = 0x12
TCP_V4_FLOW = 0x1
TCP_V6_FLOW = 0x5
TCP_WINDOW_CLAMP = 0xa TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23 TCP_ZEROCOPY_RECEIVE = 0x23
TFD_TIMER_ABSTIME = 0x1 TFD_TIMER_ABSTIME = 0x1
@@ -3530,8 +3547,6 @@ const (
UDP_NO_CHECK6_RX = 0x66 UDP_NO_CHECK6_RX = 0x66
UDP_NO_CHECK6_TX = 0x65 UDP_NO_CHECK6_TX = 0x65
UDP_SEGMENT = 0x67 UDP_SEGMENT = 0x67
UDP_V4_FLOW = 0x2
UDP_V6_FLOW = 0x6
UMOUNT_NOFOLLOW = 0x8 UMOUNT_NOFOLLOW = 0x8
USBDEVICE_SUPER_MAGIC = 0x9fa2 USBDEVICE_SUPER_MAGIC = 0x9fa2
UTIME_NOW = 0x3fffffff UTIME_NOW = 0x3fffffff
@@ -3574,7 +3589,7 @@ const (
WDIOS_TEMPPANIC = 0x4 WDIOS_TEMPPANIC = 0x4
WDIOS_UNKNOWN = -0x1 WDIOS_UNKNOWN = -0x1
WEXITED = 0x4 WEXITED = 0x4
WGALLOWEDIP_A_MAX = 0x3 WGALLOWEDIP_A_MAX = 0x4
WGDEVICE_A_MAX = 0x8 WGDEVICE_A_MAX = 0x8
WGPEER_A_MAX = 0xa WGPEER_A_MAX = 0xa
WG_CMD_MAX = 0x1 WG_CMD_MAX = 0x1
@@ -3688,6 +3703,7 @@ const (
XDP_SHARED_UMEM = 0x1 XDP_SHARED_UMEM = 0x1
XDP_STATISTICS = 0x7 XDP_STATISTICS = 0x7
XDP_TXMD_FLAGS_CHECKSUM = 0x2 XDP_TXMD_FLAGS_CHECKSUM = 0x2
XDP_TXMD_FLAGS_LAUNCH_TIME = 0x4
XDP_TXMD_FLAGS_TIMESTAMP = 0x1 XDP_TXMD_FLAGS_TIMESTAMP = 0x1
XDP_TX_METADATA = 0x2 XDP_TX_METADATA = 0x2
XDP_TX_RING = 0x3 XDP_TX_RING = 0x3
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0xfd12
ECCGETLAYOUT = 0x81484d11 ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12 ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -360,6 +361,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10 SO_PASSCRED = 0x10
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11 SO_PEERCRED = 0x11
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0xfd12
ECCGETLAYOUT = 0x81484d11 ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12 ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -361,6 +362,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10 SO_PASSCRED = 0x10
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11 SO_PEERCRED = 0x11
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0xfd12
ECCGETLAYOUT = 0x81484d11 ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12 ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -366,6 +367,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10 SO_PASSCRED = 0x10
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11 SO_PEERCRED = 0x11
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0xfd12
ECCGETLAYOUT = 0x81484d11 ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12 ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -359,6 +360,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10 SO_PASSCRED = 0x10
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11 SO_PEERCRED = 0x11
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0xfd12
ECCGETLAYOUT = 0x81484d11 ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12 ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -353,6 +354,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10 SO_PASSCRED = 0x10
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11 SO_PEERCRED = 0x11
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -359,6 +360,7 @@ const (
SO_OOBINLINE = 0x100 SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11 SO_PASSCRED = 0x11
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12 SO_PEERCRED = 0x12
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -359,6 +360,7 @@ const (
SO_OOBINLINE = 0x100 SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11 SO_PASSCRED = 0x11
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12 SO_PEERCRED = 0x12
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -359,6 +360,7 @@ const (
SO_OOBINLINE = 0x100 SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11 SO_PASSCRED = 0x11
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12 SO_PEERCRED = 0x12
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -359,6 +360,7 @@ const (
SO_OOBINLINE = 0x100 SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11 SO_PASSCRED = 0x11
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12 SO_PEERCRED = 0x12
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x300 CS8 = 0x300
CSIZE = 0x300 CSIZE = 0x300
CSTOPB = 0x400 CSTOPB = 0x400
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40 ECHOCTL = 0x40
@@ -414,6 +415,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x14 SO_PASSCRED = 0x14
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x15 SO_PEERCRED = 0x15
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x300 CS8 = 0x300
CSIZE = 0x300 CSIZE = 0x300
CSTOPB = 0x400 CSTOPB = 0x400
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40 ECHOCTL = 0x40
@@ -418,6 +419,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x14 SO_PASSCRED = 0x14
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x15 SO_PEERCRED = 0x15
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x300 CS8 = 0x300
CSIZE = 0x300 CSIZE = 0x300
CSTOPB = 0x400 CSTOPB = 0x400
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x40 ECHOCTL = 0x40
@@ -418,6 +419,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x14 SO_PASSCRED = 0x14
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x15 SO_PEERCRED = 0x15
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0xfd12
ECCGETLAYOUT = 0x81484d11 ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12 ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -350,6 +351,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10 SO_PASSCRED = 0x10
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11 SO_PEERCRED = 0x11
+2
View File
@@ -68,6 +68,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0xfd12
ECCGETLAYOUT = 0x81484d11 ECCGETLAYOUT = 0x81484d11
ECCGETSTATS = 0x80104d12 ECCGETSTATS = 0x80104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -422,6 +423,7 @@ const (
SO_OOBINLINE = 0xa SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10 SO_PASSCRED = 0x10
SO_PASSPIDFD = 0x4c SO_PASSPIDFD = 0x4c
SO_PASSRIGHTS = 0x53
SO_PASSSEC = 0x22 SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11 SO_PEERCRED = 0x11
+2
View File
@@ -71,6 +71,7 @@ const (
CS8 = 0x30 CS8 = 0x30
CSIZE = 0x30 CSIZE = 0x30
CSTOPB = 0x40 CSTOPB = 0x40
DM_MPATH_PROBE_PATHS = 0x2000fd12
ECCGETLAYOUT = 0x41484d11 ECCGETLAYOUT = 0x41484d11
ECCGETSTATS = 0x40104d12 ECCGETSTATS = 0x40104d12
ECHOCTL = 0x200 ECHOCTL = 0x200
@@ -461,6 +462,7 @@ const (
SO_OOBINLINE = 0x100 SO_OOBINLINE = 0x100
SO_PASSCRED = 0x2 SO_PASSCRED = 0x2
SO_PASSPIDFD = 0x55 SO_PASSPIDFD = 0x55
SO_PASSRIGHTS = 0x5c
SO_PASSSEC = 0x1f SO_PASSSEC = 0x1f
SO_PEEK_OFF = 0x26 SO_PEEK_OFF = 0x26
SO_PEERCRED = 0x40 SO_PEERCRED = 0x40
+1
View File
@@ -462,4 +462,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -385,4 +385,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -426,4 +426,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -329,4 +329,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -325,4 +325,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -446,4 +446,5 @@ const (
SYS_GETXATTRAT = 4464 SYS_GETXATTRAT = 4464
SYS_LISTXATTRAT = 4465 SYS_LISTXATTRAT = 4465
SYS_REMOVEXATTRAT = 4466 SYS_REMOVEXATTRAT = 4466
SYS_OPEN_TREE_ATTR = 4467
) )
+1
View File
@@ -376,4 +376,5 @@ const (
SYS_GETXATTRAT = 5464 SYS_GETXATTRAT = 5464
SYS_LISTXATTRAT = 5465 SYS_LISTXATTRAT = 5465
SYS_REMOVEXATTRAT = 5466 SYS_REMOVEXATTRAT = 5466
SYS_OPEN_TREE_ATTR = 5467
) )
+1
View File
@@ -376,4 +376,5 @@ const (
SYS_GETXATTRAT = 5464 SYS_GETXATTRAT = 5464
SYS_LISTXATTRAT = 5465 SYS_LISTXATTRAT = 5465
SYS_REMOVEXATTRAT = 5466 SYS_REMOVEXATTRAT = 5466
SYS_OPEN_TREE_ATTR = 5467
) )
+1
View File
@@ -446,4 +446,5 @@ const (
SYS_GETXATTRAT = 4464 SYS_GETXATTRAT = 4464
SYS_LISTXATTRAT = 4465 SYS_LISTXATTRAT = 4465
SYS_REMOVEXATTRAT = 4466 SYS_REMOVEXATTRAT = 4466
SYS_OPEN_TREE_ATTR = 4467
) )
+1
View File
@@ -453,4 +453,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -425,4 +425,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -425,4 +425,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -330,4 +330,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -391,4 +391,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+1
View File
@@ -404,4 +404,5 @@ const (
SYS_GETXATTRAT = 464 SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465 SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466 SYS_REMOVEXATTRAT = 466
SYS_OPEN_TREE_ATTR = 467
) )
+29 -8
View File
@@ -115,7 +115,9 @@ type Statx_t struct {
Atomic_write_unit_max uint32 Atomic_write_unit_max uint32
Atomic_write_segments_max uint32 Atomic_write_segments_max uint32
Dio_read_offset_align uint32 Dio_read_offset_align uint32
_ [9]uint64 Atomic_write_unit_max_opt uint32
_ [1]uint32
_ [8]uint64
} }
type Fsid struct { type Fsid struct {
@@ -199,7 +201,8 @@ type FscryptAddKeyArg struct {
Key_spec FscryptKeySpecifier Key_spec FscryptKeySpecifier
Raw_size uint32 Raw_size uint32
Key_id uint32 Key_id uint32
_ [8]uint32 Flags uint32
_ [7]uint32
} }
type FscryptRemoveKeyArg struct { type FscryptRemoveKeyArg struct {
@@ -2317,6 +2320,11 @@ const (
NFT_CT_AVGPKT = 0x10 NFT_CT_AVGPKT = 0x10
NFT_CT_ZONE = 0x11 NFT_CT_ZONE = 0x11
NFT_CT_EVENTMASK = 0x12 NFT_CT_EVENTMASK = 0x12
NFT_CT_SRC_IP = 0x13
NFT_CT_DST_IP = 0x14
NFT_CT_SRC_IP6 = 0x15
NFT_CT_DST_IP6 = 0x16
NFT_CT_ID = 0x17
NFTA_CT_UNSPEC = 0x0 NFTA_CT_UNSPEC = 0x0
NFTA_CT_DREG = 0x1 NFTA_CT_DREG = 0x1
NFTA_CT_KEY = 0x2 NFTA_CT_KEY = 0x2
@@ -2597,8 +2605,8 @@ const (
SOF_TIMESTAMPING_BIND_PHC = 0x8000 SOF_TIMESTAMPING_BIND_PHC = 0x8000
SOF_TIMESTAMPING_OPT_ID_TCP = 0x10000 SOF_TIMESTAMPING_OPT_ID_TCP = 0x10000
SOF_TIMESTAMPING_LAST = 0x20000 SOF_TIMESTAMPING_LAST = 0x40000
SOF_TIMESTAMPING_MASK = 0x3ffff SOF_TIMESTAMPING_MASK = 0x7ffff
SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SND = 0x0
SCM_TSTAMP_SCHED = 0x1 SCM_TSTAMP_SCHED = 0x1
@@ -4044,7 +4052,7 @@ const (
ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 ETHTOOL_A_TSINFO_PHC_INDEX = 0x5
ETHTOOL_A_TSINFO_STATS = 0x6 ETHTOOL_A_TSINFO_STATS = 0x6
ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER = 0x7 ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER = 0x7
ETHTOOL_A_TSINFO_MAX = 0x7 ETHTOOL_A_TSINFO_MAX = 0x9
ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0
ETHTOOL_A_CABLE_TEST_HEADER = 0x1 ETHTOOL_A_CABLE_TEST_HEADER = 0x1
ETHTOOL_A_CABLE_TEST_MAX = 0x1 ETHTOOL_A_CABLE_TEST_MAX = 0x1
@@ -4130,6 +4138,19 @@ const (
ETHTOOL_A_TUNNEL_INFO_MAX = 0x2 ETHTOOL_A_TUNNEL_INFO_MAX = 0x2
) )
const (
TCP_V4_FLOW = 0x1
UDP_V4_FLOW = 0x2
TCP_V6_FLOW = 0x5
UDP_V6_FLOW = 0x6
ESP_V4_FLOW = 0xa
ESP_V6_FLOW = 0xc
IP_USER_FLOW = 0xd
IPV6_USER_FLOW = 0xe
IPV6_FLOW = 0x11
ETHER_FLOW = 0x12
)
const SPEED_UNKNOWN = -0x1 const SPEED_UNKNOWN = -0x1
type EthtoolDrvinfo struct { type EthtoolDrvinfo struct {
@@ -4780,7 +4801,7 @@ const (
NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_HINT = 0xc8
NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAC_MASK = 0xd7
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
NL80211_ATTR_MAX = 0x150 NL80211_ATTR_MAX = 0x151
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS = 0x143 NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS = 0x143
@@ -5414,7 +5435,7 @@ const (
NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf
NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe
NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf
NL80211_FREQUENCY_ATTR_MAX = 0x21 NL80211_FREQUENCY_ATTR_MAX = 0x22
NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6
NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11
NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc
@@ -5530,7 +5551,7 @@ const (
NL80211_MAX_SUPP_SELECTORS = 0x80 NL80211_MAX_SUPP_SELECTORS = 0x80
NL80211_MBSSID_CONFIG_ATTR_EMA = 0x5 NL80211_MBSSID_CONFIG_ATTR_EMA = 0x5
NL80211_MBSSID_CONFIG_ATTR_INDEX = 0x3 NL80211_MBSSID_CONFIG_ATTR_INDEX = 0x3
NL80211_MBSSID_CONFIG_ATTR_MAX = 0x5 NL80211_MBSSID_CONFIG_ATTR_MAX = 0x6
NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY = 0x2 NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY = 0x2
NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES = 0x1 NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES = 0x1
NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX = 0x4 NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX = 0x4
+15 -15
View File
@@ -282,19 +282,13 @@ type Taskstats struct {
Ac_exitcode uint32 Ac_exitcode uint32
Ac_flag uint8 Ac_flag uint8
Ac_nice uint8 Ac_nice uint8
_ [4]byte _ [6]byte
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -330,17 +324,11 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
_ [4]byte _ [4]byte
Ac_tgetime uint64 Ac_tgetime uint64
@@ -348,10 +336,22 @@ type Taskstats struct {
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -300,16 +300,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -344,27 +338,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+16 -16
View File
@@ -91,7 +91,7 @@ type Stat_t struct {
Gid uint32 Gid uint32
Rdev uint64 Rdev uint64
_ uint16 _ uint16
_ [4]byte _ [6]byte
Size int64 Size int64
Blksize int32 Blksize int32
_ [4]byte _ [4]byte
@@ -273,19 +273,13 @@ type Taskstats struct {
Ac_exitcode uint32 Ac_exitcode uint32
Ac_flag uint8 Ac_flag uint8
Ac_nice uint8 Ac_nice uint8
_ [4]byte _ [6]byte
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]uint8 Ac_comm [32]uint8
@@ -321,17 +315,11 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
_ [4]byte _ [4]byte
Ac_tgetime uint64 Ac_tgetime uint64
@@ -339,10 +327,22 @@ type Taskstats struct {
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -279,16 +279,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -323,27 +317,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -280,16 +280,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -324,27 +318,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+15 -15
View File
@@ -278,19 +278,13 @@ type Taskstats struct {
Ac_exitcode uint32 Ac_exitcode uint32
Ac_flag uint8 Ac_flag uint8
Ac_nice uint8 Ac_nice uint8
_ [4]byte _ [6]byte
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -326,17 +320,11 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
_ [4]byte _ [4]byte
Ac_tgetime uint64 Ac_tgetime uint64
@@ -344,10 +332,22 @@ type Taskstats struct {
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -282,16 +282,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -326,27 +320,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -282,16 +282,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -326,27 +320,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+15 -15
View File
@@ -278,19 +278,13 @@ type Taskstats struct {
Ac_exitcode uint32 Ac_exitcode uint32
Ac_flag uint8 Ac_flag uint8
Ac_nice uint8 Ac_nice uint8
_ [4]byte _ [6]byte
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -326,17 +320,11 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
_ [4]byte _ [4]byte
Ac_tgetime uint64 Ac_tgetime uint64
@@ -344,10 +332,22 @@ type Taskstats struct {
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+16 -16
View File
@@ -90,7 +90,7 @@ type Stat_t struct {
Gid uint32 Gid uint32
Rdev uint64 Rdev uint64
_ uint16 _ uint16
_ [4]byte _ [6]byte
Size int64 Size int64
Blksize int32 Blksize int32
_ [4]byte _ [4]byte
@@ -285,19 +285,13 @@ type Taskstats struct {
Ac_exitcode uint32 Ac_exitcode uint32
Ac_flag uint8 Ac_flag uint8
Ac_nice uint8 Ac_nice uint8
_ [4]byte _ [6]byte
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]uint8 Ac_comm [32]uint8
@@ -333,17 +327,11 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
_ [4]byte _ [4]byte
Ac_tgetime uint64 Ac_tgetime uint64
@@ -351,10 +339,22 @@ type Taskstats struct {
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -289,16 +289,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]uint8 Ac_comm [32]uint8
@@ -333,27 +327,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -289,16 +289,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]uint8 Ac_comm [32]uint8
@@ -333,27 +327,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -307,16 +307,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]uint8 Ac_comm [32]uint8
@@ -351,27 +345,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -302,16 +302,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -346,27 +340,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+14 -14
View File
@@ -284,16 +284,10 @@ type Taskstats struct {
Ac_nice uint8 Ac_nice uint8
Cpu_count uint64 Cpu_count uint64
Cpu_delay_total uint64 Cpu_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_count uint64 Blkio_count uint64
Blkio_delay_total uint64 Blkio_delay_total uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_count uint64 Swapin_count uint64
Swapin_delay_total uint64 Swapin_delay_total uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Cpu_run_real_total uint64 Cpu_run_real_total uint64
Cpu_run_virtual_total uint64 Cpu_run_virtual_total uint64
Ac_comm [32]int8 Ac_comm [32]int8
@@ -328,27 +322,33 @@ type Taskstats struct {
Cpu_scaled_run_real_total uint64 Cpu_scaled_run_real_total uint64
Freepages_count uint64 Freepages_count uint64
Freepages_delay_total uint64 Freepages_delay_total uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_count uint64 Thrashing_count uint64
Thrashing_delay_total uint64 Thrashing_delay_total uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Ac_btime64 uint64 Ac_btime64 uint64
Compact_count uint64 Compact_count uint64
Compact_delay_total uint64 Compact_delay_total uint64
Compact_delay_max uint64
Compact_delay_min uint64
Ac_tgid uint32 Ac_tgid uint32
Ac_tgetime uint64 Ac_tgetime uint64
Ac_exe_dev uint64 Ac_exe_dev uint64
Ac_exe_inode uint64 Ac_exe_inode uint64
Wpcopy_count uint64 Wpcopy_count uint64
Wpcopy_delay_total uint64 Wpcopy_delay_total uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_count uint64 Irq_count uint64
Irq_delay_total uint64 Irq_delay_total uint64
Cpu_delay_max uint64
Cpu_delay_min uint64
Blkio_delay_max uint64
Blkio_delay_min uint64
Swapin_delay_max uint64
Swapin_delay_min uint64
Freepages_delay_max uint64
Freepages_delay_min uint64
Thrashing_delay_max uint64
Thrashing_delay_min uint64
Compact_delay_max uint64
Compact_delay_min uint64
Wpcopy_delay_max uint64
Wpcopy_delay_min uint64
Irq_delay_max uint64 Irq_delay_max uint64
Irq_delay_min uint64 Irq_delay_min uint64
} }
+3 -1
View File
@@ -20,12 +20,14 @@ func isTerminal(fd int) bool {
return err == nil return err == nil
} }
// This is intended to be used on a console input handle.
// See https://learn.microsoft.com/en-us/windows/console/setconsolemode
func makeRaw(fd int) (*State, error) { func makeRaw(fd int) (*State, error) {
var st uint32 var st uint32
if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil { if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
return nil, err return nil, err
} }
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT) raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT)
raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil { if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
return nil, err return nil, err
+7 -2
View File
@@ -146,6 +146,7 @@ const (
keyCtrlD = 4 keyCtrlD = 4
keyCtrlU = 21 keyCtrlU = 21
keyEnter = '\r' keyEnter = '\r'
keyLF = '\n'
keyEscape = 27 keyEscape = 27
keyBackspace = 127 keyBackspace = 127
keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota
@@ -497,7 +498,7 @@ func (t *Terminal) historyAdd(entry string) {
// handleKey processes the given key and, optionally, returns a line of text // handleKey processes the given key and, optionally, returns a line of text
// that the user has entered. // that the user has entered.
func (t *Terminal) handleKey(key rune) (line string, ok bool) { func (t *Terminal) handleKey(key rune) (line string, ok bool) {
if t.pasteActive && key != keyEnter { if t.pasteActive && key != keyEnter && key != keyLF {
t.addKeyToLine(key) t.addKeyToLine(key)
return return
} }
@@ -567,7 +568,7 @@ func (t *Terminal) handleKey(key rune) (line string, ok bool) {
t.setLine(runes, len(runes)) t.setLine(runes, len(runes))
} }
} }
case keyEnter: case keyEnter, keyLF:
t.moveCursorToPos(len(t.line)) t.moveCursorToPos(len(t.line))
t.queue([]rune("\r\n")) t.queue([]rune("\r\n"))
line = string(t.line) line = string(t.line)
@@ -812,6 +813,10 @@ func (t *Terminal) readLine() (line string, err error) {
if !t.pasteActive { if !t.pasteActive {
lineIsPasted = false lineIsPasted = false
} }
// If we have CR, consume LF if present (CRLF sequence) to avoid returning an extra empty line.
if key == keyEnter && len(rest) > 0 && rest[0] == keyLF {
rest = rest[1:]
}
line, lineOk = t.handleKey(key) line, lineOk = t.handleKey(key)
} }
if len(rest) > 0 { if len(rest) > 0 {
+25 -1
View File
@@ -371,7 +371,31 @@ func ConsumeVarint(b []byte) (v uint64, n int) {
func SizeVarint(v uint64) int { func SizeVarint(v uint64) int {
// This computes 1 + (bits.Len64(v)-1)/7. // This computes 1 + (bits.Len64(v)-1)/7.
// 9/64 is a good enough approximation of 1/7 // 9/64 is a good enough approximation of 1/7
return int(9*uint32(bits.Len64(v))+64) / 64 //
// The Go compiler can translate the bits.LeadingZeros64 call into the LZCNT
// instruction, which is very fast on CPUs from the last few years. The
// specific way of expressing the calculation matches C++ Protobuf, see
// https://godbolt.org/z/4P3h53oM4 for the C++ code and how gcc/clang
// optimize that function for GOAMD64=v1 and GOAMD64=v3 (-march=haswell).
// By OR'ing v with 1, we guarantee that v is never 0, without changing the
// result of SizeVarint. LZCNT is not defined for 0, meaning the compiler
// needs to add extra instructions to handle that case.
//
// The Go compiler currently (go1.24.4) does not make use of this knowledge.
// This opportunity (removing the XOR instruction, which handles the 0 case)
// results in a small (1%) performance win across CPU architectures.
//
// Independently of avoiding the 0 case, we need the v |= 1 line because
// it allows the Go compiler to eliminate an extra XCHGL barrier.
v |= 1
// It would be clearer to write log2value := 63 - uint32(...), but
// writing uint32(...) ^ 63 is much more efficient (-14% ARM, -20% Intel).
// Proof of identity for our value range [0..63]:
// https://go.dev/play/p/Pdn9hEWYakX
log2value := uint32(bits.LeadingZeros64(v)) ^ 63
return int((log2value*9 + (64 + 9)) / 64)
} }
// AppendFixed32 appends v to b as a little-endian uint32. // AppendFixed32 appends v to b as a little-endian uint32.
+3
View File
@@ -72,6 +72,9 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures {
case genid.FeatureSet_EnforceNamingStyle_field_number: case genid.FeatureSet_EnforceNamingStyle_field_number:
// EnforceNamingStyle is enforced in protoc, languages other than C++ // EnforceNamingStyle is enforced in protoc, languages other than C++
// are not supposed to do anything with this feature. // are not supposed to do anything with this feature.
case genid.FeatureSet_DefaultSymbolVisibility_field_number:
// DefaultSymbolVisibility is enforced in protoc, runtimes should not
// inspect this value.
default: default:
panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num)) panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num))
} }
+33
View File
@@ -0,0 +1,33 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package filedesc
import "google.golang.org/protobuf/reflect/protoreflect"
// UsePresenceForField reports whether the presence bitmap should be used for
// the specified field.
func UsePresenceForField(fd protoreflect.FieldDescriptor) (usePresence, canBeLazy bool) {
switch {
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
// Oneof fields never use the presence bitmap.
//
// Synthetic oneofs are an exception: Those are used to implement proto3
// optional fields and hence should follow non-oneof field semantics.
return false, false
case fd.IsMap():
// Map-typed fields never use the presence bitmap.
return false, false
case fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind:
// Lazy fields always use the presence bitmap (only messages can be lazy).
isLazy := fd.(interface{ IsLazy() bool }).IsLazy()
return isLazy, isLazy
default:
// If the field has presence, use the presence bitmap.
return fd.HasPresence(), false
}
}
+67 -21
View File
@@ -34,6 +34,19 @@ const (
Edition_EDITION_MAX_enum_value = 2147483647 Edition_EDITION_MAX_enum_value = 2147483647
) )
// Full and short names for google.protobuf.SymbolVisibility.
const (
SymbolVisibility_enum_fullname = "google.protobuf.SymbolVisibility"
SymbolVisibility_enum_name = "SymbolVisibility"
)
// Enum values for google.protobuf.SymbolVisibility.
const (
SymbolVisibility_VISIBILITY_UNSET_enum_value = 0
SymbolVisibility_VISIBILITY_LOCAL_enum_value = 1
SymbolVisibility_VISIBILITY_EXPORT_enum_value = 2
)
// Names for google.protobuf.FileDescriptorSet. // Names for google.protobuf.FileDescriptorSet.
const ( const (
FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet" FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet"
@@ -65,6 +78,7 @@ const (
FileDescriptorProto_Dependency_field_name protoreflect.Name = "dependency" FileDescriptorProto_Dependency_field_name protoreflect.Name = "dependency"
FileDescriptorProto_PublicDependency_field_name protoreflect.Name = "public_dependency" FileDescriptorProto_PublicDependency_field_name protoreflect.Name = "public_dependency"
FileDescriptorProto_WeakDependency_field_name protoreflect.Name = "weak_dependency" FileDescriptorProto_WeakDependency_field_name protoreflect.Name = "weak_dependency"
FileDescriptorProto_OptionDependency_field_name protoreflect.Name = "option_dependency"
FileDescriptorProto_MessageType_field_name protoreflect.Name = "message_type" FileDescriptorProto_MessageType_field_name protoreflect.Name = "message_type"
FileDescriptorProto_EnumType_field_name protoreflect.Name = "enum_type" FileDescriptorProto_EnumType_field_name protoreflect.Name = "enum_type"
FileDescriptorProto_Service_field_name protoreflect.Name = "service" FileDescriptorProto_Service_field_name protoreflect.Name = "service"
@@ -79,6 +93,7 @@ const (
FileDescriptorProto_Dependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.dependency" FileDescriptorProto_Dependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.dependency"
FileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.public_dependency" FileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.public_dependency"
FileDescriptorProto_WeakDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.weak_dependency" FileDescriptorProto_WeakDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.weak_dependency"
FileDescriptorProto_OptionDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.option_dependency"
FileDescriptorProto_MessageType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.message_type" FileDescriptorProto_MessageType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.message_type"
FileDescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.enum_type" FileDescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.enum_type"
FileDescriptorProto_Service_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.service" FileDescriptorProto_Service_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.service"
@@ -96,6 +111,7 @@ const (
FileDescriptorProto_Dependency_field_number protoreflect.FieldNumber = 3 FileDescriptorProto_Dependency_field_number protoreflect.FieldNumber = 3
FileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10 FileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10
FileDescriptorProto_WeakDependency_field_number protoreflect.FieldNumber = 11 FileDescriptorProto_WeakDependency_field_number protoreflect.FieldNumber = 11
FileDescriptorProto_OptionDependency_field_number protoreflect.FieldNumber = 15
FileDescriptorProto_MessageType_field_number protoreflect.FieldNumber = 4 FileDescriptorProto_MessageType_field_number protoreflect.FieldNumber = 4
FileDescriptorProto_EnumType_field_number protoreflect.FieldNumber = 5 FileDescriptorProto_EnumType_field_number protoreflect.FieldNumber = 5
FileDescriptorProto_Service_field_number protoreflect.FieldNumber = 6 FileDescriptorProto_Service_field_number protoreflect.FieldNumber = 6
@@ -124,6 +140,7 @@ const (
DescriptorProto_Options_field_name protoreflect.Name = "options" DescriptorProto_Options_field_name protoreflect.Name = "options"
DescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range" DescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range"
DescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name" DescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name"
DescriptorProto_Visibility_field_name protoreflect.Name = "visibility"
DescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.name" DescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.name"
DescriptorProto_Field_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.field" DescriptorProto_Field_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.field"
@@ -135,6 +152,7 @@ const (
DescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.options" DescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.options"
DescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_range" DescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_range"
DescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_name" DescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_name"
DescriptorProto_Visibility_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.visibility"
) )
// Field numbers for google.protobuf.DescriptorProto. // Field numbers for google.protobuf.DescriptorProto.
@@ -149,6 +167,7 @@ const (
DescriptorProto_Options_field_number protoreflect.FieldNumber = 7 DescriptorProto_Options_field_number protoreflect.FieldNumber = 7
DescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 9 DescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 9
DescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 10 DescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 10
DescriptorProto_Visibility_field_number protoreflect.FieldNumber = 11
) )
// Names for google.protobuf.DescriptorProto.ExtensionRange. // Names for google.protobuf.DescriptorProto.ExtensionRange.
@@ -388,12 +407,14 @@ const (
EnumDescriptorProto_Options_field_name protoreflect.Name = "options" EnumDescriptorProto_Options_field_name protoreflect.Name = "options"
EnumDescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range" EnumDescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range"
EnumDescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name" EnumDescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name"
EnumDescriptorProto_Visibility_field_name protoreflect.Name = "visibility"
EnumDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.name" EnumDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.name"
EnumDescriptorProto_Value_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.value" EnumDescriptorProto_Value_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.value"
EnumDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.options" EnumDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.options"
EnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_range" EnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_range"
EnumDescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_name" EnumDescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_name"
EnumDescriptorProto_Visibility_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.visibility"
) )
// Field numbers for google.protobuf.EnumDescriptorProto. // Field numbers for google.protobuf.EnumDescriptorProto.
@@ -403,6 +424,7 @@ const (
EnumDescriptorProto_Options_field_number protoreflect.FieldNumber = 3 EnumDescriptorProto_Options_field_number protoreflect.FieldNumber = 3
EnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4 EnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4
EnumDescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 5 EnumDescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 5
EnumDescriptorProto_Visibility_field_number protoreflect.FieldNumber = 6
) )
// Names for google.protobuf.EnumDescriptorProto.EnumReservedRange. // Names for google.protobuf.EnumDescriptorProto.EnumReservedRange.
@@ -1008,32 +1030,35 @@ const (
// Field names for google.protobuf.FeatureSet. // Field names for google.protobuf.FeatureSet.
const ( const (
FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence" FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence"
FeatureSet_EnumType_field_name protoreflect.Name = "enum_type" FeatureSet_EnumType_field_name protoreflect.Name = "enum_type"
FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding" FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding"
FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation" FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation"
FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding" FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding"
FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format" FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format"
FeatureSet_EnforceNamingStyle_field_name protoreflect.Name = "enforce_naming_style" FeatureSet_EnforceNamingStyle_field_name protoreflect.Name = "enforce_naming_style"
FeatureSet_DefaultSymbolVisibility_field_name protoreflect.Name = "default_symbol_visibility"
FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence" FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence"
FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type" FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type"
FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding" FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding"
FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation" FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation"
FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding" FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding"
FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format" FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format"
FeatureSet_EnforceNamingStyle_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enforce_naming_style" FeatureSet_EnforceNamingStyle_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enforce_naming_style"
FeatureSet_DefaultSymbolVisibility_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.default_symbol_visibility"
) )
// Field numbers for google.protobuf.FeatureSet. // Field numbers for google.protobuf.FeatureSet.
const ( const (
FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1 FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1
FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2 FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2
FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3 FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3
FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4 FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4
FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5 FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5
FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6 FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6
FeatureSet_EnforceNamingStyle_field_number protoreflect.FieldNumber = 7 FeatureSet_EnforceNamingStyle_field_number protoreflect.FieldNumber = 7
FeatureSet_DefaultSymbolVisibility_field_number protoreflect.FieldNumber = 8
) )
// Full and short names for google.protobuf.FeatureSet.FieldPresence. // Full and short names for google.protobuf.FeatureSet.FieldPresence.
@@ -1128,6 +1153,27 @@ const (
FeatureSet_STYLE_LEGACY_enum_value = 2 FeatureSet_STYLE_LEGACY_enum_value = 2
) )
// Names for google.protobuf.FeatureSet.VisibilityFeature.
const (
FeatureSet_VisibilityFeature_message_name protoreflect.Name = "VisibilityFeature"
FeatureSet_VisibilityFeature_message_fullname protoreflect.FullName = "google.protobuf.FeatureSet.VisibilityFeature"
)
// Full and short names for google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility.
const (
FeatureSet_VisibilityFeature_DefaultSymbolVisibility_enum_fullname = "google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility"
FeatureSet_VisibilityFeature_DefaultSymbolVisibility_enum_name = "DefaultSymbolVisibility"
)
// Enum values for google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility.
const (
FeatureSet_VisibilityFeature_DEFAULT_SYMBOL_VISIBILITY_UNKNOWN_enum_value = 0
FeatureSet_VisibilityFeature_EXPORT_ALL_enum_value = 1
FeatureSet_VisibilityFeature_EXPORT_TOP_LEVEL_enum_value = 2
FeatureSet_VisibilityFeature_LOCAL_ALL_enum_value = 3
FeatureSet_VisibilityFeature_STRICT_enum_value = 4
)
// Names for google.protobuf.FeatureSetDefaults. // Names for google.protobuf.FeatureSetDefaults.
const ( const (
FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults" FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults"
+2 -1
View File
@@ -11,6 +11,7 @@ import (
"google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/encoding/messageset"
"google.golang.org/protobuf/internal/filedesc"
"google.golang.org/protobuf/internal/order" "google.golang.org/protobuf/internal/order"
"google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoreflect"
piface "google.golang.org/protobuf/runtime/protoiface" piface "google.golang.org/protobuf/runtime/protoiface"
@@ -80,7 +81,7 @@ func (mi *MessageInfo) makeOpaqueCoderMethods(t reflect.Type, si opaqueStructInf
// permit us to skip over definitely-unset fields at marshal time. // permit us to skip over definitely-unset fields at marshal time.
var hasPresence bool var hasPresence bool
hasPresence, cf.isLazy = usePresenceForField(si, fd) hasPresence, cf.isLazy = filedesc.UsePresenceForField(fd)
if hasPresence { if hasPresence {
cf.presenceIndex, mi.presenceSize = presenceIndex(mi.Desc, fd) cf.presenceIndex, mi.presenceSize = presenceIndex(mi.Desc, fd)
+8 -37
View File
@@ -11,6 +11,7 @@ import (
"strings" "strings"
"sync/atomic" "sync/atomic"
"google.golang.org/protobuf/internal/filedesc"
"google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoreflect"
) )
@@ -53,7 +54,7 @@ func opaqueInitHook(mi *MessageInfo) bool {
fd := fds.Get(i) fd := fds.Get(i)
fs := si.fieldsByNumber[fd.Number()] fs := si.fieldsByNumber[fd.Number()]
var fi fieldInfo var fi fieldInfo
usePresence, _ := usePresenceForField(si, fd) usePresence, _ := filedesc.UsePresenceForField(fd)
switch { switch {
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic(): case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
@@ -343,17 +344,15 @@ func (mi *MessageInfo) fieldInfoForMessageListOpaqueNoPresence(si opaqueStructIn
if p.IsNil() { if p.IsNil() {
return false return false
} }
sp := p.Apply(fieldOffset).AtomicGetPointer() rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
if sp.IsNil() { if rv.IsNil() {
return false return false
} }
rv := sp.AsValueOf(fs.Type.Elem())
return rv.Elem().Len() > 0 return rv.Elem().Len() > 0
}, },
clear: func(p pointer) { clear: func(p pointer) {
sp := p.Apply(fieldOffset).AtomicGetPointer() rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
if !sp.IsNil() { if !rv.IsNil() {
rv := sp.AsValueOf(fs.Type.Elem())
rv.Elem().Set(reflect.Zero(rv.Type().Elem())) rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
} }
}, },
@@ -361,11 +360,10 @@ func (mi *MessageInfo) fieldInfoForMessageListOpaqueNoPresence(si opaqueStructIn
if p.IsNil() { if p.IsNil() {
return conv.Zero() return conv.Zero()
} }
sp := p.Apply(fieldOffset).AtomicGetPointer() rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
if sp.IsNil() { if rv.IsNil() {
return conv.Zero() return conv.Zero()
} }
rv := sp.AsValueOf(fs.Type.Elem())
if rv.Elem().Len() == 0 { if rv.Elem().Len() == 0 {
return conv.Zero() return conv.Zero()
} }
@@ -598,30 +596,3 @@ func (mi *MessageInfo) clearPresent(p pointer, index uint32) {
func (mi *MessageInfo) present(p pointer, index uint32) bool { func (mi *MessageInfo) present(p pointer, index uint32) bool {
return p.Apply(mi.presenceOffset).PresenceInfo().Present(index) return p.Apply(mi.presenceOffset).PresenceInfo().Present(index)
} }
// usePresenceForField implements the somewhat intricate logic of when
// the presence bitmap is used for a field. The main logic is that a
// field that is optional or that can be lazy will use the presence
// bit, but for proto2, also maps have a presence bit. It also records
// if the field can ever be lazy, which is true if we have a
// lazyOffset and the field is a message or a slice of messages. A
// field that is lazy will always need a presence bit. Oneofs are not
// lazy and do not use presence, unless they are a synthetic oneof,
// which is a proto3 optional field. For proto3 optionals, we use the
// presence and they can also be lazy when applicable (a message).
func usePresenceForField(si opaqueStructInfo, fd protoreflect.FieldDescriptor) (usePresence, canBeLazy bool) {
hasLazyField := fd.(interface{ IsLazy() bool }).IsLazy()
// Non-oneof scalar fields with explicit field presence use the presence array.
usesPresenceArray := fd.HasPresence() && fd.Message() == nil && (fd.ContainingOneof() == nil || fd.ContainingOneof().IsSynthetic())
switch {
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
return false, false
case fd.IsMap():
return false, false
case fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind:
return hasLazyField, hasLazyField
default:
return usesPresenceArray || (hasLazyField && fd.HasPresence()), false
}
}
-3
View File
@@ -32,9 +32,6 @@ func (p presence) toElem(num uint32) (ret *uint32) {
// Present checks for the presence of a specific field number in a presence set. // Present checks for the presence of a specific field number in a presence set.
func (p presence) Present(num uint32) bool { func (p presence) Present(num uint32) bool {
if p.P == nil {
return false
}
return Export{}.Present(p.toElem(num), num) return Export{}.Present(p.toElem(num), num)
} }

Some files were not shown because too many files have changed in this diff Show More