github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/mock/network_metrics.go (about) 1 // Code generated by mockery v2.21.4. DO NOT EDIT. 2 3 package mock 4 5 import ( 6 channels "github.com/onflow/flow-go/network/channels" 7 mock "github.com/stretchr/testify/mock" 8 9 network "github.com/libp2p/go-libp2p/core/network" 10 11 p2pmsg "github.com/onflow/flow-go/network/p2p/message" 12 13 peer "github.com/libp2p/go-libp2p/core/peer" 14 15 protocol "github.com/libp2p/go-libp2p/core/protocol" 16 17 time "time" 18 ) 19 20 // NetworkMetrics is an autogenerated mock type for the NetworkMetrics type 21 type NetworkMetrics struct { 22 mock.Mock 23 } 24 25 // AllowConn provides a mock function with given fields: dir, usefd 26 func (_m *NetworkMetrics) AllowConn(dir network.Direction, usefd bool) { 27 _m.Called(dir, usefd) 28 } 29 30 // AllowMemory provides a mock function with given fields: size 31 func (_m *NetworkMetrics) AllowMemory(size int) { 32 _m.Called(size) 33 } 34 35 // AllowPeer provides a mock function with given fields: p 36 func (_m *NetworkMetrics) AllowPeer(p peer.ID) { 37 _m.Called(p) 38 } 39 40 // AllowProtocol provides a mock function with given fields: proto 41 func (_m *NetworkMetrics) AllowProtocol(proto protocol.ID) { 42 _m.Called(proto) 43 } 44 45 // AllowService provides a mock function with given fields: svc 46 func (_m *NetworkMetrics) AllowService(svc string) { 47 _m.Called(svc) 48 } 49 50 // AllowStream provides a mock function with given fields: p, dir 51 func (_m *NetworkMetrics) AllowStream(p peer.ID, dir network.Direction) { 52 _m.Called(p, dir) 53 } 54 55 // AsyncProcessingFinished provides a mock function with given fields: duration 56 func (_m *NetworkMetrics) AsyncProcessingFinished(duration time.Duration) { 57 _m.Called(duration) 58 } 59 60 // AsyncProcessingStarted provides a mock function with given fields: 61 func (_m *NetworkMetrics) AsyncProcessingStarted() { 62 _m.Called() 63 } 64 65 // BlockConn provides a mock function with given fields: dir, usefd 66 func (_m *NetworkMetrics) BlockConn(dir network.Direction, usefd bool) { 67 _m.Called(dir, usefd) 68 } 69 70 // BlockMemory provides a mock function with given fields: size 71 func (_m *NetworkMetrics) BlockMemory(size int) { 72 _m.Called(size) 73 } 74 75 // BlockPeer provides a mock function with given fields: p 76 func (_m *NetworkMetrics) BlockPeer(p peer.ID) { 77 _m.Called(p) 78 } 79 80 // BlockProtocol provides a mock function with given fields: proto 81 func (_m *NetworkMetrics) BlockProtocol(proto protocol.ID) { 82 _m.Called(proto) 83 } 84 85 // BlockProtocolPeer provides a mock function with given fields: proto, p 86 func (_m *NetworkMetrics) BlockProtocolPeer(proto protocol.ID, p peer.ID) { 87 _m.Called(proto, p) 88 } 89 90 // BlockService provides a mock function with given fields: svc 91 func (_m *NetworkMetrics) BlockService(svc string) { 92 _m.Called(svc) 93 } 94 95 // BlockServicePeer provides a mock function with given fields: svc, p 96 func (_m *NetworkMetrics) BlockServicePeer(svc string, p peer.ID) { 97 _m.Called(svc, p) 98 } 99 100 // BlockStream provides a mock function with given fields: p, dir 101 func (_m *NetworkMetrics) BlockStream(p peer.ID, dir network.Direction) { 102 _m.Called(p, dir) 103 } 104 105 // DNSLookupDuration provides a mock function with given fields: duration 106 func (_m *NetworkMetrics) DNSLookupDuration(duration time.Duration) { 107 _m.Called(duration) 108 } 109 110 // DuplicateInboundMessagesDropped provides a mock function with given fields: topic, _a1, messageType 111 func (_m *NetworkMetrics) DuplicateInboundMessagesDropped(topic string, _a1 string, messageType string) { 112 _m.Called(topic, _a1, messageType) 113 } 114 115 // DuplicateMessagePenalties provides a mock function with given fields: penalty 116 func (_m *NetworkMetrics) DuplicateMessagePenalties(penalty float64) { 117 _m.Called(penalty) 118 } 119 120 // DuplicateMessagesCounts provides a mock function with given fields: count 121 func (_m *NetworkMetrics) DuplicateMessagesCounts(count float64) { 122 _m.Called(count) 123 } 124 125 // InboundConnections provides a mock function with given fields: connectionCount 126 func (_m *NetworkMetrics) InboundConnections(connectionCount uint) { 127 _m.Called(connectionCount) 128 } 129 130 // InboundMessageReceived provides a mock function with given fields: sizeBytes, topic, _a2, messageType 131 func (_m *NetworkMetrics) InboundMessageReceived(sizeBytes int, topic string, _a2 string, messageType string) { 132 _m.Called(sizeBytes, topic, _a2, messageType) 133 } 134 135 // MessageAdded provides a mock function with given fields: priority 136 func (_m *NetworkMetrics) MessageAdded(priority int) { 137 _m.Called(priority) 138 } 139 140 // MessageProcessingFinished provides a mock function with given fields: topic, duration 141 func (_m *NetworkMetrics) MessageProcessingFinished(topic string, duration time.Duration) { 142 _m.Called(topic, duration) 143 } 144 145 // MessageProcessingStarted provides a mock function with given fields: topic 146 func (_m *NetworkMetrics) MessageProcessingStarted(topic string) { 147 _m.Called(topic) 148 } 149 150 // MessageRemoved provides a mock function with given fields: priority 151 func (_m *NetworkMetrics) MessageRemoved(priority int) { 152 _m.Called(priority) 153 } 154 155 // OnActiveClusterIDsNotSetErr provides a mock function with given fields: 156 func (_m *NetworkMetrics) OnActiveClusterIDsNotSetErr() { 157 _m.Called() 158 } 159 160 // OnAppSpecificScoreUpdated provides a mock function with given fields: _a0 161 func (_m *NetworkMetrics) OnAppSpecificScoreUpdated(_a0 float64) { 162 _m.Called(_a0) 163 } 164 165 // OnBehaviourPenaltyUpdated provides a mock function with given fields: _a0 166 func (_m *NetworkMetrics) OnBehaviourPenaltyUpdated(_a0 float64) { 167 _m.Called(_a0) 168 } 169 170 // OnControlMessagesTruncated provides a mock function with given fields: messageType, diff 171 func (_m *NetworkMetrics) OnControlMessagesTruncated(messageType p2pmsg.ControlMessageType, diff int) { 172 _m.Called(messageType, diff) 173 } 174 175 // OnDNSCacheHit provides a mock function with given fields: 176 func (_m *NetworkMetrics) OnDNSCacheHit() { 177 _m.Called() 178 } 179 180 // OnDNSCacheInvalidated provides a mock function with given fields: 181 func (_m *NetworkMetrics) OnDNSCacheInvalidated() { 182 _m.Called() 183 } 184 185 // OnDNSCacheMiss provides a mock function with given fields: 186 func (_m *NetworkMetrics) OnDNSCacheMiss() { 187 _m.Called() 188 } 189 190 // OnDNSLookupRequestDropped provides a mock function with given fields: 191 func (_m *NetworkMetrics) OnDNSLookupRequestDropped() { 192 _m.Called() 193 } 194 195 // OnDialRetryBudgetResetToDefault provides a mock function with given fields: 196 func (_m *NetworkMetrics) OnDialRetryBudgetResetToDefault() { 197 _m.Called() 198 } 199 200 // OnDialRetryBudgetUpdated provides a mock function with given fields: budget 201 func (_m *NetworkMetrics) OnDialRetryBudgetUpdated(budget uint64) { 202 _m.Called(budget) 203 } 204 205 // OnEstablishStreamFailure provides a mock function with given fields: duration, attempts 206 func (_m *NetworkMetrics) OnEstablishStreamFailure(duration time.Duration, attempts int) { 207 _m.Called(duration, attempts) 208 } 209 210 // OnFirstMessageDeliveredUpdated provides a mock function with given fields: _a0, _a1 211 func (_m *NetworkMetrics) OnFirstMessageDeliveredUpdated(_a0 channels.Topic, _a1 float64) { 212 _m.Called(_a0, _a1) 213 } 214 215 // OnGraftDuplicateTopicIdsExceedThreshold provides a mock function with given fields: 216 func (_m *NetworkMetrics) OnGraftDuplicateTopicIdsExceedThreshold() { 217 _m.Called() 218 } 219 220 // OnGraftInvalidTopicIdsExceedThreshold provides a mock function with given fields: 221 func (_m *NetworkMetrics) OnGraftInvalidTopicIdsExceedThreshold() { 222 _m.Called() 223 } 224 225 // OnGraftMessageInspected provides a mock function with given fields: duplicateTopicIds, invalidTopicIds 226 func (_m *NetworkMetrics) OnGraftMessageInspected(duplicateTopicIds int, invalidTopicIds int) { 227 _m.Called(duplicateTopicIds, invalidTopicIds) 228 } 229 230 // OnIHaveControlMessageIdsTruncated provides a mock function with given fields: diff 231 func (_m *NetworkMetrics) OnIHaveControlMessageIdsTruncated(diff int) { 232 _m.Called(diff) 233 } 234 235 // OnIHaveDuplicateMessageIdsExceedThreshold provides a mock function with given fields: 236 func (_m *NetworkMetrics) OnIHaveDuplicateMessageIdsExceedThreshold() { 237 _m.Called() 238 } 239 240 // OnIHaveDuplicateTopicIdsExceedThreshold provides a mock function with given fields: 241 func (_m *NetworkMetrics) OnIHaveDuplicateTopicIdsExceedThreshold() { 242 _m.Called() 243 } 244 245 // OnIHaveInvalidTopicIdsExceedThreshold provides a mock function with given fields: 246 func (_m *NetworkMetrics) OnIHaveInvalidTopicIdsExceedThreshold() { 247 _m.Called() 248 } 249 250 // OnIHaveMessageIDsReceived provides a mock function with given fields: channel, msgIdCount 251 func (_m *NetworkMetrics) OnIHaveMessageIDsReceived(channel string, msgIdCount int) { 252 _m.Called(channel, msgIdCount) 253 } 254 255 // OnIHaveMessagesInspected provides a mock function with given fields: duplicateTopicIds, duplicateMessageIds, invalidTopicIds 256 func (_m *NetworkMetrics) OnIHaveMessagesInspected(duplicateTopicIds int, duplicateMessageIds int, invalidTopicIds int) { 257 _m.Called(duplicateTopicIds, duplicateMessageIds, invalidTopicIds) 258 } 259 260 // OnIPColocationFactorUpdated provides a mock function with given fields: _a0 261 func (_m *NetworkMetrics) OnIPColocationFactorUpdated(_a0 float64) { 262 _m.Called(_a0) 263 } 264 265 // OnIWantCacheMissMessageIdsExceedThreshold provides a mock function with given fields: 266 func (_m *NetworkMetrics) OnIWantCacheMissMessageIdsExceedThreshold() { 267 _m.Called() 268 } 269 270 // OnIWantControlMessageIdsTruncated provides a mock function with given fields: diff 271 func (_m *NetworkMetrics) OnIWantControlMessageIdsTruncated(diff int) { 272 _m.Called(diff) 273 } 274 275 // OnIWantDuplicateMessageIdsExceedThreshold provides a mock function with given fields: 276 func (_m *NetworkMetrics) OnIWantDuplicateMessageIdsExceedThreshold() { 277 _m.Called() 278 } 279 280 // OnIWantMessageIDsReceived provides a mock function with given fields: msgIdCount 281 func (_m *NetworkMetrics) OnIWantMessageIDsReceived(msgIdCount int) { 282 _m.Called(msgIdCount) 283 } 284 285 // OnIWantMessagesInspected provides a mock function with given fields: duplicateCount, cacheMissCount 286 func (_m *NetworkMetrics) OnIWantMessagesInspected(duplicateCount int, cacheMissCount int) { 287 _m.Called(duplicateCount, cacheMissCount) 288 } 289 290 // OnIncomingRpcReceived provides a mock function with given fields: iHaveCount, iWantCount, graftCount, pruneCount, msgCount 291 func (_m *NetworkMetrics) OnIncomingRpcReceived(iHaveCount int, iWantCount int, graftCount int, pruneCount int, msgCount int) { 292 _m.Called(iHaveCount, iWantCount, graftCount, pruneCount, msgCount) 293 } 294 295 // OnInvalidControlMessageNotificationSent provides a mock function with given fields: 296 func (_m *NetworkMetrics) OnInvalidControlMessageNotificationSent() { 297 _m.Called() 298 } 299 300 // OnInvalidMessageDeliveredUpdated provides a mock function with given fields: _a0, _a1 301 func (_m *NetworkMetrics) OnInvalidMessageDeliveredUpdated(_a0 channels.Topic, _a1 float64) { 302 _m.Called(_a0, _a1) 303 } 304 305 // OnInvalidTopicIdDetectedForControlMessage provides a mock function with given fields: messageType 306 func (_m *NetworkMetrics) OnInvalidTopicIdDetectedForControlMessage(messageType p2pmsg.ControlMessageType) { 307 _m.Called(messageType) 308 } 309 310 // OnLocalMeshSizeUpdated provides a mock function with given fields: topic, size 311 func (_m *NetworkMetrics) OnLocalMeshSizeUpdated(topic string, size int) { 312 _m.Called(topic, size) 313 } 314 315 // OnLocalPeerJoinedTopic provides a mock function with given fields: 316 func (_m *NetworkMetrics) OnLocalPeerJoinedTopic() { 317 _m.Called() 318 } 319 320 // OnLocalPeerLeftTopic provides a mock function with given fields: 321 func (_m *NetworkMetrics) OnLocalPeerLeftTopic() { 322 _m.Called() 323 } 324 325 // OnMeshMessageDeliveredUpdated provides a mock function with given fields: _a0, _a1 326 func (_m *NetworkMetrics) OnMeshMessageDeliveredUpdated(_a0 channels.Topic, _a1 float64) { 327 _m.Called(_a0, _a1) 328 } 329 330 // OnMessageDeliveredToAllSubscribers provides a mock function with given fields: size 331 func (_m *NetworkMetrics) OnMessageDeliveredToAllSubscribers(size int) { 332 _m.Called(size) 333 } 334 335 // OnMessageDuplicate provides a mock function with given fields: size 336 func (_m *NetworkMetrics) OnMessageDuplicate(size int) { 337 _m.Called(size) 338 } 339 340 // OnMessageEnteredValidation provides a mock function with given fields: size 341 func (_m *NetworkMetrics) OnMessageEnteredValidation(size int) { 342 _m.Called(size) 343 } 344 345 // OnMessageRejected provides a mock function with given fields: size, reason 346 func (_m *NetworkMetrics) OnMessageRejected(size int, reason string) { 347 _m.Called(size, reason) 348 } 349 350 // OnMisbehaviorReported provides a mock function with given fields: channel, misbehaviorType 351 func (_m *NetworkMetrics) OnMisbehaviorReported(channel string, misbehaviorType string) { 352 _m.Called(channel, misbehaviorType) 353 } 354 355 // OnOutboundRpcDropped provides a mock function with given fields: 356 func (_m *NetworkMetrics) OnOutboundRpcDropped() { 357 _m.Called() 358 } 359 360 // OnOverallPeerScoreUpdated provides a mock function with given fields: _a0 361 func (_m *NetworkMetrics) OnOverallPeerScoreUpdated(_a0 float64) { 362 _m.Called(_a0) 363 } 364 365 // OnPeerAddedToProtocol provides a mock function with given fields: _a0 366 func (_m *NetworkMetrics) OnPeerAddedToProtocol(_a0 string) { 367 _m.Called(_a0) 368 } 369 370 // OnPeerDialFailure provides a mock function with given fields: duration, attempts 371 func (_m *NetworkMetrics) OnPeerDialFailure(duration time.Duration, attempts int) { 372 _m.Called(duration, attempts) 373 } 374 375 // OnPeerDialed provides a mock function with given fields: duration, attempts 376 func (_m *NetworkMetrics) OnPeerDialed(duration time.Duration, attempts int) { 377 _m.Called(duration, attempts) 378 } 379 380 // OnPeerGraftTopic provides a mock function with given fields: topic 381 func (_m *NetworkMetrics) OnPeerGraftTopic(topic string) { 382 _m.Called(topic) 383 } 384 385 // OnPeerPruneTopic provides a mock function with given fields: topic 386 func (_m *NetworkMetrics) OnPeerPruneTopic(topic string) { 387 _m.Called(topic) 388 } 389 390 // OnPeerRemovedFromProtocol provides a mock function with given fields: 391 func (_m *NetworkMetrics) OnPeerRemovedFromProtocol() { 392 _m.Called() 393 } 394 395 // OnPeerThrottled provides a mock function with given fields: 396 func (_m *NetworkMetrics) OnPeerThrottled() { 397 _m.Called() 398 } 399 400 // OnPruneDuplicateTopicIdsExceedThreshold provides a mock function with given fields: 401 func (_m *NetworkMetrics) OnPruneDuplicateTopicIdsExceedThreshold() { 402 _m.Called() 403 } 404 405 // OnPruneInvalidTopicIdsExceedThreshold provides a mock function with given fields: 406 func (_m *NetworkMetrics) OnPruneInvalidTopicIdsExceedThreshold() { 407 _m.Called() 408 } 409 410 // OnPruneMessageInspected provides a mock function with given fields: duplicateTopicIds, invalidTopicIds 411 func (_m *NetworkMetrics) OnPruneMessageInspected(duplicateTopicIds int, invalidTopicIds int) { 412 _m.Called(duplicateTopicIds, invalidTopicIds) 413 } 414 415 // OnPublishMessageInspected provides a mock function with given fields: totalErrCount, invalidTopicIdsCount, invalidSubscriptionsCount, invalidSendersCount 416 func (_m *NetworkMetrics) OnPublishMessageInspected(totalErrCount int, invalidTopicIdsCount int, invalidSubscriptionsCount int, invalidSendersCount int) { 417 _m.Called(totalErrCount, invalidTopicIdsCount, invalidSubscriptionsCount, invalidSendersCount) 418 } 419 420 // OnPublishMessagesInspectionErrorExceedsThreshold provides a mock function with given fields: 421 func (_m *NetworkMetrics) OnPublishMessagesInspectionErrorExceedsThreshold() { 422 _m.Called() 423 } 424 425 // OnRateLimitedPeer provides a mock function with given fields: pid, role, msgType, topic, reason 426 func (_m *NetworkMetrics) OnRateLimitedPeer(pid peer.ID, role string, msgType string, topic string, reason string) { 427 _m.Called(pid, role, msgType, topic, reason) 428 } 429 430 // OnRpcReceived provides a mock function with given fields: msgCount, iHaveCount, iWantCount, graftCount, pruneCount 431 func (_m *NetworkMetrics) OnRpcReceived(msgCount int, iHaveCount int, iWantCount int, graftCount int, pruneCount int) { 432 _m.Called(msgCount, iHaveCount, iWantCount, graftCount, pruneCount) 433 } 434 435 // OnRpcRejectedFromUnknownSender provides a mock function with given fields: 436 func (_m *NetworkMetrics) OnRpcRejectedFromUnknownSender() { 437 _m.Called() 438 } 439 440 // OnRpcSent provides a mock function with given fields: msgCount, iHaveCount, iWantCount, graftCount, pruneCount 441 func (_m *NetworkMetrics) OnRpcSent(msgCount int, iHaveCount int, iWantCount int, graftCount int, pruneCount int) { 442 _m.Called(msgCount, iHaveCount, iWantCount, graftCount, pruneCount) 443 } 444 445 // OnStreamCreated provides a mock function with given fields: duration, attempts 446 func (_m *NetworkMetrics) OnStreamCreated(duration time.Duration, attempts int) { 447 _m.Called(duration, attempts) 448 } 449 450 // OnStreamCreationFailure provides a mock function with given fields: duration, attempts 451 func (_m *NetworkMetrics) OnStreamCreationFailure(duration time.Duration, attempts int) { 452 _m.Called(duration, attempts) 453 } 454 455 // OnStreamCreationRetryBudgetResetToDefault provides a mock function with given fields: 456 func (_m *NetworkMetrics) OnStreamCreationRetryBudgetResetToDefault() { 457 _m.Called() 458 } 459 460 // OnStreamCreationRetryBudgetUpdated provides a mock function with given fields: budget 461 func (_m *NetworkMetrics) OnStreamCreationRetryBudgetUpdated(budget uint64) { 462 _m.Called(budget) 463 } 464 465 // OnStreamEstablished provides a mock function with given fields: duration, attempts 466 func (_m *NetworkMetrics) OnStreamEstablished(duration time.Duration, attempts int) { 467 _m.Called(duration, attempts) 468 } 469 470 // OnTimeInMeshUpdated provides a mock function with given fields: _a0, _a1 471 func (_m *NetworkMetrics) OnTimeInMeshUpdated(_a0 channels.Topic, _a1 time.Duration) { 472 _m.Called(_a0, _a1) 473 } 474 475 // OnUnauthorizedMessage provides a mock function with given fields: role, msgType, topic, offense 476 func (_m *NetworkMetrics) OnUnauthorizedMessage(role string, msgType string, topic string, offense string) { 477 _m.Called(role, msgType, topic, offense) 478 } 479 480 // OnUndeliveredMessage provides a mock function with given fields: 481 func (_m *NetworkMetrics) OnUndeliveredMessage() { 482 _m.Called() 483 } 484 485 // OnUnstakedPeerInspectionFailed provides a mock function with given fields: 486 func (_m *NetworkMetrics) OnUnstakedPeerInspectionFailed() { 487 _m.Called() 488 } 489 490 // OnViolationReportSkipped provides a mock function with given fields: 491 func (_m *NetworkMetrics) OnViolationReportSkipped() { 492 _m.Called() 493 } 494 495 // OutboundConnections provides a mock function with given fields: connectionCount 496 func (_m *NetworkMetrics) OutboundConnections(connectionCount uint) { 497 _m.Called(connectionCount) 498 } 499 500 // OutboundMessageSent provides a mock function with given fields: sizeBytes, topic, _a2, messageType 501 func (_m *NetworkMetrics) OutboundMessageSent(sizeBytes int, topic string, _a2 string, messageType string) { 502 _m.Called(sizeBytes, topic, _a2, messageType) 503 } 504 505 // QueueDuration provides a mock function with given fields: duration, priority 506 func (_m *NetworkMetrics) QueueDuration(duration time.Duration, priority int) { 507 _m.Called(duration, priority) 508 } 509 510 // RoutingTablePeerAdded provides a mock function with given fields: 511 func (_m *NetworkMetrics) RoutingTablePeerAdded() { 512 _m.Called() 513 } 514 515 // RoutingTablePeerRemoved provides a mock function with given fields: 516 func (_m *NetworkMetrics) RoutingTablePeerRemoved() { 517 _m.Called() 518 } 519 520 // SetWarningStateCount provides a mock function with given fields: _a0 521 func (_m *NetworkMetrics) SetWarningStateCount(_a0 uint) { 522 _m.Called(_a0) 523 } 524 525 // UnicastMessageSendingCompleted provides a mock function with given fields: topic 526 func (_m *NetworkMetrics) UnicastMessageSendingCompleted(topic string) { 527 _m.Called(topic) 528 } 529 530 // UnicastMessageSendingStarted provides a mock function with given fields: topic 531 func (_m *NetworkMetrics) UnicastMessageSendingStarted(topic string) { 532 _m.Called(topic) 533 } 534 535 type mockConstructorTestingTNewNetworkMetrics interface { 536 mock.TestingT 537 Cleanup(func()) 538 } 539 540 // NewNetworkMetrics creates a new instance of NetworkMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 541 func NewNetworkMetrics(t mockConstructorTestingTNewNetworkMetrics) *NetworkMetrics { 542 mock := &NetworkMetrics{} 543 mock.Mock.Test(t) 544 545 t.Cleanup(func() { mock.AssertExpectations(t) }) 546 547 return mock 548 }