blob: 1ae6c5133a1a8de09cca90f4b12d300b51b68252 [file] [log] [blame]
Jiri Simsa756772c2015-03-25 15:40:54 -07001// Copyright 2015 The Vanadium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
Jungho Ahn48d43072015-02-23 18:50:27 -08005package stress
6
7import (
Todd Wang387d8a42015-03-30 17:09:05 -07008 "v.io/v23/security/access"
Jungho Ahn48d43072015-02-23 18:50:27 -08009)
10
Jungho Ahn5a96d9a2015-04-21 16:39:20 -070011type SumArg struct {
Jungho Ahn48d43072015-02-23 18:50:27 -080012 ABool bool
13 AInt64 int64
14 AListOfBytes []byte
15}
16
Jungho Ahn5a96d9a2015-04-21 16:39:20 -070017type SumStats struct {
Jungho Ahn48d43072015-02-23 18:50:27 -080018 SumCount uint64
19 SumStreamCount uint64
Jungho Ahn5a96d9a2015-04-21 16:39:20 -070020 BytesRecv uint64
21 BytesSent uint64
Jungho Ahn48d43072015-02-23 18:50:27 -080022}
23
24type Stress interface {
Jungho Ahn5a96d9a2015-04-21 16:39:20 -070025 // Echo returns the payload that it receives.
26 Echo(Payload []byte) ([]byte | error) {access.Read}
27
Jungho Ahn48d43072015-02-23 18:50:27 -080028 // Do returns the checksum of the payload that it receives.
Jungho Ahn5a96d9a2015-04-21 16:39:20 -070029 Sum(arg SumArg) ([]byte | error) {access.Read}
Jungho Ahn48d43072015-02-23 18:50:27 -080030
31 // DoStream returns the checksum of the payload that it receives via the stream.
Jungho Ahn5a96d9a2015-04-21 16:39:20 -070032 SumStream() stream<SumArg,[]byte> error {access.Read}
Jungho Ahn48d43072015-02-23 18:50:27 -080033
Jungho Ahn5a96d9a2015-04-21 16:39:20 -070034 // GetSumStats returns the stats on the Sum calls that the server received.
35 GetSumStats() (SumStats | error) {access.Read}
Jungho Ahn48d43072015-02-23 18:50:27 -080036
37 // Stop stops the server.
38 Stop() error {access.Admin}
39}