Skip to content

Commit 2a61dad

Browse files
committed
updates codex to 0.1.4
1 parent 2d90349 commit 2a61dad

File tree

5 files changed

+64
-34
lines changed

5 files changed

+64
-34
lines changed

ProjectPlugins/CodexPlugin/ApiChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace CodexPlugin
99
public class ApiChecker
1010
{
1111
// <INSERT-OPENAPI-YAML-HASH>
12-
private const string OpenApiYamlHash = "67-76-AB-FC-54-4F-EB-81-F5-E4-F8-27-DF-82-92-41-63-A5-EA-1B-17-14-0C-BE-20-9C-B3-DF-CE-E4-AA-38";
12+
private const string OpenApiYamlHash = "6B-94-24-A4-D5-01-6F-12-E9-34-74-36-80-57-7A-3A-79-8C-E8-02-68-B7-05-DA-50-A0-5C-B1-02-B9-AE-C6";
1313
private const string OpenApiFilePath = "/codex/openapi.yaml";
1414
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
1515

ProjectPlugins/CodexPlugin/CodexAccess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public StorageAvailability SalesAvailability(StorageAvailability request)
9494

9595
public StorageAvailability[] GetAvailabilities()
9696
{
97-
var collection = OnCodex<ICollection<SalesAvailability>>(api => api.GetOfferedStorageAsync());
97+
var collection = OnCodex<ICollection<SalesAvailabilityREAD>>(api => api.GetAvailabilitiesAsync());
9898
return mapper.Map(collection);
9999
}
100100

ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace CodexPlugin
77
{
88
public class CodexContainerRecipe : ContainerRecipeFactory
99
{
10-
private const string DefaultDockerImage = "codexstorage/nim-codex:sha-032d7e7-dist-tests";
10+
private const string DefaultDockerImage = "codexstorage/nim-codex:0.1.4";
1111
public const string ApiPortTag = "codex_api_port";
1212
public const string ListenPortTag = "codex_listen_port";
1313
public const string MetricsPortTag = "codex_metrics_port";

ProjectPlugins/CodexPlugin/Mapper.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public CodexOpenApi.StorageRequestCreation Map(StoragePurchaseRequest purchase)
6363
};
6464
}
6565

66-
public StorageAvailability[] Map(ICollection<SalesAvailability> availabilities)
66+
public StorageAvailability[] Map(ICollection<SalesAvailabilityREAD> availabilities)
6767
{
6868
return availabilities.Select(a => Map(a)).ToArray();
6969
}
7070

71-
public StorageAvailability Map(SalesAvailability availability)
71+
public StorageAvailability Map(SalesAvailabilityREAD availability)
7272
{
7373
var freeSize = (string)availability.AdditionalProperties["freeSize"];
7474

@@ -127,19 +127,6 @@ public StorageAvailability Map(SalesAvailability availability)
127127
// };
128128
//}
129129

130-
public StorageAvailability Map(CodexOpenApi.SalesAvailabilityREAD read)
131-
{
132-
return new StorageAvailability(
133-
totalSpace: new ByteSize(Convert.ToInt64(read.TotalSize)),
134-
maxDuration: TimeSpan.FromSeconds(Convert.ToDouble(read.Duration)),
135-
minPriceForTotalSpace: new TestToken(BigInteger.Parse(read.MinPrice)),
136-
maxCollateral: new TestToken(BigInteger.Parse(read.MaxCollateral))
137-
)
138-
{
139-
Id = read.Id
140-
};
141-
}
142-
143130
public CodexSpace Map(Space space)
144131
{
145132
return new CodexSpace

ProjectPlugins/CodexPlugin/openapi.yaml

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ components:
2323
Id:
2424
type: string
2525
description: 32bits identifier encoded in hex-decimal string.
26+
minLength: 66
27+
maxLength: 66
2628
example: 0x...
2729

2830
BigInt:
@@ -136,7 +138,7 @@ components:
136138
$ref: "#/components/schemas/Duration"
137139
minPrice:
138140
type: string
139-
description: Minimum price to be paid (in amount of tokens) as decimal string
141+
description: Minimal price paid (in amount of tokens) for the whole hosted request's slot for the request's duration as decimal string
140142
maxCollateral:
141143
type: string
142144
description: Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string
@@ -168,7 +170,39 @@ components:
168170
$ref: "#/components/schemas/StorageRequest"
169171
slotIndex:
170172
type: string
171-
description: Slot Index as hexadecimal string
173+
description: Slot Index as decimal string
174+
175+
SlotAgent:
176+
type: object
177+
properties:
178+
id:
179+
$ref: "#/components/schemas/SlotId"
180+
slotIndex:
181+
type: string
182+
description: Slot Index as decimal string
183+
requestId:
184+
$ref: "#/components/schemas/Id"
185+
request:
186+
$ref: "#/components/schemas/StorageRequest"
187+
reservation:
188+
$ref: "#/components/schemas/Reservation"
189+
state:
190+
type: string
191+
description: Description of the slot's
192+
enum:
193+
- SaleCancelled
194+
- SaleDownloading
195+
- SaleErrored
196+
- SaleFailed
197+
- SaleFilled
198+
- SaleFilling
199+
- SaleFinished
200+
- SaleIgnored
201+
- SaleInitialProving
202+
- SalePayout
203+
- SalePreparing
204+
- SaleProving
205+
- SaleUnknown
172206

173207
Reservation:
174208
type: object
@@ -183,7 +217,7 @@ components:
183217
$ref: "#/components/schemas/Id"
184218
slotIndex:
185219
type: string
186-
description: Slot Index as hexadecimal string
220+
description: Slot Index as decimal string
187221

188222
StorageRequestCreation:
189223
type: object
@@ -259,6 +293,15 @@ components:
259293
state:
260294
type: string
261295
description: Description of the Request's state
296+
enum:
297+
- cancelled
298+
- error
299+
- failed
300+
- finished
301+
- pending
302+
- started
303+
- submitted
304+
- unknown
262305
error:
263306
type: string
264307
description: If Request failed, then here is presented the error message
@@ -491,7 +534,7 @@ paths:
491534
$ref: "#/components/schemas/Slot"
492535

493536
"503":
494-
description: Sales are unavailable
537+
description: Persistence is not enabled
495538

496539
"/sales/slots/{slotId}":
497540
get:
@@ -511,7 +554,7 @@ paths:
511554
content:
512555
application/json:
513556
schema:
514-
$ref: "#/components/schemas/Slot"
557+
$ref: "#/components/schemas/SlotAgent"
515558

516559
"400":
517560
description: Invalid or missing SlotId
@@ -520,13 +563,13 @@ paths:
520563
description: Host is not in an active sale for the slot
521564

522565
"503":
523-
description: Sales are unavailable
566+
description: Persistence is not enabled
524567

525568
"/sales/availability":
526569
get:
527570
summary: "Returns storage that is for sale"
528571
tags: [ Marketplace ]
529-
operationId: getOfferedStorage
572+
operationId: getAvailabilities
530573
responses:
531574
"200":
532575
description: Retrieved storage availabilities of the node
@@ -535,11 +578,11 @@ paths:
535578
schema:
536579
type: array
537580
items:
538-
$ref: "#/components/schemas/SalesAvailability"
581+
$ref: "#/components/schemas/SalesAvailabilityREAD"
539582
"500":
540583
description: Error getting unused availabilities
541584
"503":
542-
description: Sales are unavailable
585+
description: Persistence is not enabled
543586

544587
post:
545588
summary: "Offers storage for sale"
@@ -564,7 +607,7 @@ paths:
564607
"500":
565608
description: Error reserving availability
566609
"503":
567-
description: Sales are unavailable
610+
description: Persistence is not enabled
568611
"/sales/availability/{id}":
569612
patch:
570613
summary: "Updates availability"
@@ -597,10 +640,10 @@ paths:
597640
"500":
598641
description: Error reserving availability
599642
"503":
600-
description: Sales are unavailable
643+
description: Persistence is not enabled
601644

602645
"/sales/availability/{id}/reservations":
603-
patch:
646+
get:
604647
summary: "Get availability's reservations"
605648
description: Return's list of Reservations for ongoing Storage Requests that the node hosts.
606649
operationId: getReservations
@@ -628,7 +671,7 @@ paths:
628671
"500":
629672
description: Error getting reservations
630673
"503":
631-
description: Sales are unavailable
674+
description: Persistence is not enabled
632675

633676
"/storage/request/{cid}":
634677
post:
@@ -659,7 +702,7 @@ paths:
659702
"404":
660703
description: Request ID not found
661704
"503":
662-
description: Purchasing is unavailable
705+
description: Persistence is not enabled
663706

664707
"/storage/purchases":
665708
get:
@@ -676,7 +719,7 @@ paths:
676719
items:
677720
type: string
678721
"503":
679-
description: Purchasing is unavailable
722+
description: Persistence is not enabled
680723

681724
"/storage/purchases/{id}":
682725
get:
@@ -702,7 +745,7 @@ paths:
702745
"404":
703746
description: Purchase not found
704747
"503":
705-
description: Purchasing is unavailable
748+
description: Persistence is not enabled
706749

707750
"/node/spr":
708751
get:

0 commit comments

Comments
 (0)