prepare service management
This commit is contained in:
@@ -8,6 +8,7 @@ export class ImageManager {
|
||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||
public smartbucketInstance: plugins.smartbucket.SmartBucket;
|
||||
public imageDir: plugins.smartbucket.Directory;
|
||||
public dockerImageStore: plugins.docker.DockerImageStore;
|
||||
|
||||
get db() {
|
||||
return this.cloudlyRef.mongodbConnector.smartdataDb;
|
||||
@@ -72,9 +73,18 @@ export class ImageManager {
|
||||
this.typedrouter.addTypedHandler(
|
||||
new plugins.typedrequest.TypedHandler<plugins.servezoneInterfaces.requests.image.IRequest_PushImageVersion>(
|
||||
'pushImageVersion',
|
||||
async (reqArg) => {
|
||||
const pushStream = reqArg.imageStream;
|
||||
return {};
|
||||
async (reqArg, toolsArg) => {
|
||||
const image = await this.CImage.getInstance({
|
||||
id: reqArg.imageId,
|
||||
});
|
||||
if (!image) {
|
||||
throw new plugins.typedrequest.TypedResponseError('Image not found');
|
||||
}
|
||||
const imageVersion = reqArg.versionString;
|
||||
const imagePushStream = reqArg.imageStream;
|
||||
return {
|
||||
allowed: true,
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
@@ -87,7 +97,9 @@ export class ImageManager {
|
||||
id: reqArg.imageId,
|
||||
});
|
||||
const imageVersion = image.data.versions.find((version) => version.versionString === reqArg.versionString);
|
||||
const readable = this.imageDir.fastGetStream(await image.getStoragePath(reqArg.versionString));
|
||||
const readable = this.imageDir.fastGetStream({
|
||||
path: await image.getStoragePath(reqArg.versionString),
|
||||
}, 'webstream');
|
||||
const imageVirtualStream = new plugins.typedrequest.VirtualStream();
|
||||
return {
|
||||
imageStream: imageVirtualStream,
|
||||
@@ -111,10 +123,4 @@ export class ImageManager {
|
||||
path: 'images',
|
||||
});
|
||||
}
|
||||
|
||||
public async createImage(nameArg: string) {
|
||||
const newImage = await this.CImage.create({
|
||||
name: nameArg,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user