Skip to content

Commit acb0bf4

Browse files
committed
Updates to latest
1 parent 8fe0bd6 commit acb0bf4

File tree

5 files changed

+88
-22
lines changed

5 files changed

+88
-22
lines changed

ProjectPlugins/CodexPlugin/ApiChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace CodexPlugin
1010
public class ApiChecker
1111
{
1212
// <INSERT-OPENAPI-YAML-HASH>
13-
private const string OpenApiYamlHash = "C1-50-18-D5-73-64-1C-D8-74-DB-75-0D-C1-3D-AB-82-D6-A3-05-3E-49-2B-82-0B-0F-92-BC-DC-32-BE-56-C9";
13+
private const string OpenApiYamlHash = "39-0C-32-A3-EA-90-4F-29-1C-67-12-F1-D5-BE-31-67-8D-90-43-1E-F2-02-63-5B-0C-49-F7-1E-E5-EC-F7-00";
1414
private const string OpenApiFilePath = "/codex/openapi.yaml";
1515
private const string DisableEnvironmentVariable = "CODEXPLUGIN_DISABLE_APICHECK";
1616

ProjectPlugins/CodexPlugin/CodexAccess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public Stream DownloadFile(string contentId, Action<Failure> onFailure)
8282

8383
public LocalDatasetList LocalFiles()
8484
{
85-
return mapper.Map(OnCodex(api => api.ListDataAsync()));
85+
return mapper.Map(OnCodex(api => api.ListDataAsync("", "")));
8686
}
8787

8888
public StorageAvailability SalesAvailability(StorageAvailability request)

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:0.1.7-dist-tests";
10+
private const string DefaultDockerImage = "codexstorage/nim-codex:latest-dist-tests";
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: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public DebugInfo Map(CodexOpenApi.DebugInfo debugInfo)
1616
Spr = debugInfo.Spr,
1717
Addrs = debugInfo.Addrs.ToArray(),
1818
AnnounceAddresses = JArray(debugInfo.AdditionalProperties, "announceAddresses").Select(x => x.ToString()).ToArray(),
19-
Version = MapDebugInfoVersion(JObject(debugInfo.AdditionalProperties, "codex")),
20-
Table = MapDebugInfoTable(JObject(debugInfo.AdditionalProperties, "table"))
19+
Version = Map(debugInfo.Codex),
20+
Table = Map(debugInfo.Table)
2121
};
2222
}
2323

@@ -136,47 +136,45 @@ public CodexSpace Map(Space space)
136136
};
137137
}
138138

139-
private DebugInfoVersion MapDebugInfoVersion(JObject obj)
139+
private DebugInfoVersion Map(CodexVersion obj)
140140
{
141141
return new DebugInfoVersion
142142
{
143-
Version = StringOrEmpty(obj, "version"),
144-
Revision = StringOrEmpty(obj, "revision")
143+
Version = obj.Version,
144+
Revision = obj.Revision
145145
};
146146
}
147147

148-
private DebugInfoTable MapDebugInfoTable(JObject obj)
148+
private DebugInfoTable Map(PeersTable obj)
149149
{
150150
return new DebugInfoTable
151151
{
152-
LocalNode = MapDebugInfoTableNode(obj.GetValue("localNode")),
153-
Nodes = MapDebugInfoTableNodeArray(obj.GetValue("nodes") as JArray)
152+
LocalNode = Map(obj.LocalNode),
153+
Nodes = Map(obj.Nodes)
154154
};
155155
}
156156

157-
private DebugInfoTableNode MapDebugInfoTableNode(JToken? token)
157+
private DebugInfoTableNode Map(Node? token)
158158
{
159-
var obj = token as JObject;
160-
if (obj == null) return new DebugInfoTableNode();
161-
159+
if (token == null) return new DebugInfoTableNode();
162160
return new DebugInfoTableNode
163161
{
164-
Address = StringOrEmpty(obj, "address"),
165-
NodeId = StringOrEmpty(obj, "nodeId"),
166-
PeerId = StringOrEmpty(obj, "peerId"),
167-
Record = StringOrEmpty(obj, "record"),
168-
Seen = Bool(obj, "seen")
162+
Address = token.Address,
163+
NodeId = token.NodeId,
164+
PeerId = token.PeerId,
165+
Record = token.Record,
166+
Seen = token.Seen
169167
};
170168
}
171169

172-
private DebugInfoTableNode[] MapDebugInfoTableNodeArray(JArray? nodes)
170+
private DebugInfoTableNode[] Map(ICollection<Node> nodes)
173171
{
174172
if (nodes == null || nodes.Count == 0)
175173
{
176174
return new DebugInfoTableNode[0];
177175
}
178176

179-
return nodes.Select(MapDebugInfoTableNode).ToArray();
177+
return nodes.Select(Map).ToArray();
180178
}
181179

182180
private Manifest MapManifest(CodexOpenApi.ManifestItem manifest)

ProjectPlugins/CodexPlugin/openapi.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,40 @@ components:
9090
cid:
9191
$ref: "#/components/schemas/Cid"
9292

93+
Node:
94+
type: object
95+
properties:
96+
nodeId:
97+
type: string
98+
peerId:
99+
type: string
100+
record:
101+
type: string
102+
address:
103+
type: string
104+
seen:
105+
type: boolean
106+
107+
CodexVersion:
108+
type: object
109+
properties:
110+
version:
111+
type: string
112+
example: v0.1.7
113+
revision:
114+
type: string
115+
example: 0c647d8
116+
117+
PeersTable:
118+
type: object
119+
properties:
120+
localNode:
121+
$ref: "#/components/schemas/Node"
122+
nodes:
123+
type: array
124+
items:
125+
$ref: "#/components/schemas/Node"
126+
93127
DebugInfo:
94128
type: object
95129
properties:
@@ -104,6 +138,10 @@ components:
104138
description: Path of the data repository where all nodes data are stored
105139
spr:
106140
$ref: "#/components/schemas/SPR"
141+
table:
142+
$ref: "#/components/schemas/PeersTable"
143+
codex:
144+
$ref: "#/components/schemas/CodexVersion"
107145

108146
SalesAvailability:
109147
type: object
@@ -319,6 +357,19 @@ components:
319357
protected:
320358
type: boolean
321359
description: "Indicates if content is protected by erasure-coding"
360+
filename:
361+
type: string
362+
description: "The original name of the uploaded content (optional)"
363+
example: codex.png
364+
mimetype:
365+
type: string
366+
description: "The original mimetype of the uploaded content (optional)"
367+
example: image/png
368+
uploadedAt:
369+
type: integer
370+
format: int64
371+
description: "The UTC upload timestamp in seconds"
372+
example: 1729244192
322373

323374
Space:
324375
type: object
@@ -392,6 +443,21 @@ paths:
392443
summary: "Lists manifest CIDs stored locally in node."
393444
tags: [ Data ]
394445
operationId: listData
446+
parameters:
447+
- name: content-type
448+
in: header
449+
required: false
450+
description: The content type of the file. Must be valid.
451+
schema:
452+
type: string
453+
example: "image/png"
454+
- name: content-disposition
455+
in: header
456+
required: false
457+
description: The content disposition used to send the filename.
458+
schema:
459+
type: string
460+
example: "attachment; filename=\"codex.png\""
395461
responses:
396462
"200":
397463
description: Retrieved list of content CIDs
@@ -404,6 +470,8 @@ paths:
404470
description: Invalid CID is specified
405471
"404":
406472
description: Content specified by the CID is not found
473+
"422":
474+
description: The content type is not a valid content type or the filename is not valid
407475
"500":
408476
description: Well it was bad-bad
409477
post:

0 commit comments

Comments
 (0)