BREAKING CHANGE(DockerHost): Refactor public API to DockerHost facade; introduce DockerResource base; make resource static methods internal; support flexible descriptors and stream compatibility
This commit is contained in:
27
ts/classes.base.ts
Normal file
27
ts/classes.base.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { DockerHost } from './classes.host.js';
|
||||
|
||||
/**
|
||||
* Abstract base class for all Docker resources.
|
||||
* Provides standardized patterns for resource management and lifecycle.
|
||||
*/
|
||||
export abstract class DockerResource {
|
||||
/**
|
||||
* Reference to the DockerHost that manages this resource.
|
||||
* All API operations go through this host instance.
|
||||
*/
|
||||
protected readonly dockerHost: DockerHost;
|
||||
|
||||
/**
|
||||
* Creates a new Docker resource instance.
|
||||
* @param dockerHost The DockerHost instance that manages this resource
|
||||
*/
|
||||
constructor(dockerHost: DockerHost) {
|
||||
this.dockerHost = dockerHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes this resource's state from the Docker daemon.
|
||||
* Implementations should fetch current data and update instance properties.
|
||||
*/
|
||||
abstract refresh(): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user