Jiri Simsa | 756772c | 2015-03-25 15:40:54 -0700 | [diff] [blame] | 1 | // 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 Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 5 | package stress |
| 6 | |
| 7 | import ( |
Todd Wang | 387d8a4 | 2015-03-30 17:09:05 -0700 | [diff] [blame] | 8 | "v.io/v23/security/access" |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 9 | ) |
| 10 | |
Jungho Ahn | 5a96d9a | 2015-04-21 16:39:20 -0700 | [diff] [blame] | 11 | type SumArg struct { |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 12 | ABool bool |
| 13 | AInt64 int64 |
| 14 | AListOfBytes []byte |
| 15 | } |
| 16 | |
Jungho Ahn | 5a96d9a | 2015-04-21 16:39:20 -0700 | [diff] [blame] | 17 | type SumStats struct { |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 18 | SumCount uint64 |
| 19 | SumStreamCount uint64 |
Jungho Ahn | 5a96d9a | 2015-04-21 16:39:20 -0700 | [diff] [blame] | 20 | BytesRecv uint64 |
| 21 | BytesSent uint64 |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | type Stress interface { |
Jungho Ahn | 5a96d9a | 2015-04-21 16:39:20 -0700 | [diff] [blame] | 25 | // Echo returns the payload that it receives. |
| 26 | Echo(Payload []byte) ([]byte | error) {access.Read} |
| 27 | |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 28 | // Do returns the checksum of the payload that it receives. |
Jungho Ahn | 5a96d9a | 2015-04-21 16:39:20 -0700 | [diff] [blame] | 29 | Sum(arg SumArg) ([]byte | error) {access.Read} |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 30 | |
| 31 | // DoStream returns the checksum of the payload that it receives via the stream. |
Jungho Ahn | 5a96d9a | 2015-04-21 16:39:20 -0700 | [diff] [blame] | 32 | SumStream() stream<SumArg,[]byte> error {access.Read} |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 33 | |
Jungho Ahn | 5a96d9a | 2015-04-21 16:39:20 -0700 | [diff] [blame] | 34 | // GetSumStats returns the stats on the Sum calls that the server received. |
| 35 | GetSumStats() (SumStats | error) {access.Read} |
Jungho Ahn | 48d4307 | 2015-02-23 18:50:27 -0800 | [diff] [blame] | 36 | |
| 37 | // Stop stops the server. |
| 38 | Stop() error {access.Admin} |
| 39 | } |