@@ -16,108 +16,6 @@ import (
1616
1717// === Helper Functions ===
1818
19- // runBatchPutGetCycle performs a BatchWriteItem-BatchGetItem cycle with 25 items and measures performance
20- // func (b *DBESDKBenchmark) runBatchPutGetCycle(data []byte) (float64, float64, error) {
21- // ctx := context.Background()
22- // tableName := b.Config.TableName
23-
24- // // Create 25 write requests with same data, different sort_key
25- // var items []map[string]types.AttributeValue
26-
27- // for i := 0; i < 25; i++ {
28- // item := map[string]types.AttributeValue{
29- // "partition_key": &types.AttributeValueMemberS{Value: "benchmark-test"},
30- // "sort_key": &types.AttributeValueMemberN{Value: strconv.Itoa(i)},
31- // "attribute1": &types.AttributeValueMemberM{Value: map[string]types.AttributeValue{
32- // "data": &types.AttributeValueMemberB{Value: data},
33- // }},
34- // "attribute2": &types.AttributeValueMemberS{Value: "sign me!"},
35- // ":attribute3": &types.AttributeValueMemberS{Value: "ignore me!"},
36- // }
37- // items = append(items, item)
38- // }
39-
40- // var writeRequests []types.WriteRequest
41- // for _, item := range items {
42- // writeRequests = append(writeRequests, types.WriteRequest{
43- // PutRequest: &types.PutRequest{Item: item},
44- // })
45- // }
46-
47- // // BatchWriteItem
48- // batchWriteStart := time.Now()
49- // _, err := b.DbesdkClient.BatchWriteItem(ctx, &dynamodb.BatchWriteItemInput{
50- // RequestItems: map[string][]types.WriteRequest{tableName: writeRequests},
51- // })
52- // if err != nil {
53- // return 0, 0, fmt.Errorf("BatchWriteItem failed: %w", err)
54- // }
55- // batchWriteDuration := time.Since(batchWriteStart).Seconds() * 1000
56-
57- // // Create 25 keys for BatchGetItem
58- // var keys []map[string]types.AttributeValue
59- // for i := 0; i < 25; i++ {
60- // keys = append(keys, map[string]types.AttributeValue{
61- // "partition_key": &types.AttributeValueMemberS{Value: "benchmark-test"},
62- // "sort_key": &types.AttributeValueMemberN{Value: strconv.Itoa(i)},
63- // })
64- // }
65-
66- // // BatchGetItem
67- // batchGetStart := time.Now()
68- // result, err := b.DbesdkClient.BatchGetItem(ctx, &dynamodb.BatchGetItemInput{
69- // RequestItems: map[string]types.KeysAndAttributes{
70- // tableName: {Keys: keys, ConsistentRead: aws.Bool(true)},
71- // },
72- // })
73- // if err != nil {
74- // return 0, 0, fmt.Errorf("BatchGetItem failed: %w", err)
75- // }
76- // batchGetDuration := time.Since(batchGetStart).Seconds() * 1000
77-
78- // // Verify 25 items retrieved with correct data size
79- // returnedItems := result.Responses[tableName]
80- // if len(returnedItems) != 25 {
81- // return 0, 0, fmt.Errorf("expected 25 items, got %d", len(returnedItems))
82- // }
83-
84- // // Verify each returned item
85- // for i, item := range returnedItems {
86- // if _, ok := item["attribute1"]; !ok {
87- // return 0, 0, fmt.Errorf("item %d missing attribute1", i)
88- // }
89-
90- // // Verify attribute1
91- // if attr1, ok := item["attribute1"].(*types.AttributeValueMemberM); ok {
92- // if dataAttr, ok := attr1.Value["data"].(*types.AttributeValueMemberB); ok {
93- // if !bytes.Equal(dataAttr.Value, data) {
94- // return 0, 0, fmt.Errorf("item %d data mismatch", i)
95- // }
96- // }
97- // }
98-
99- // // Verify attribute2 value
100- // if attr2, ok := item["attribute2"].(*types.AttributeValueMemberS); ok {
101- // if attr2.Value != "sign me!" {
102- // return 0, 0, fmt.Errorf("item %d attribute2 mismatch: got %s", i, attr2.Value)
103- // }
104- // } else {
105- // return 0, 0, fmt.Errorf("item %d attribute2 wrong type", i)
106- // }
107-
108- // // Verify :attribute3 value
109- // if attr3, ok := item[":attribute3"].(*types.AttributeValueMemberS); ok {
110- // if attr3.Value != "ignore me!" {
111- // return 0, 0, fmt.Errorf("item %d :attribute3 mismatch: got %s", i, attr3.Value)
112- // }
113- // } else {
114- // return 0, 0, fmt.Errorf("item %d :attribute3 wrong type", i)
115- // }
116- // }
117-
118- // return batchWriteDuration, batchGetDuration, nil
119- // }
120-
12119// runItemEncryptorCycle performs a item encryptor encrypt and decrypt cycle with 25 items and measures performance
12220func (b * DBESDKBenchmark ) runItemEncryptorCycle (data []byte ) (float64 , float64 , error ) {
12321 item := map [string ]types.AttributeValue {
0 commit comments