Milvus.ts 937 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { WS_EVENTS, WS_EVENTS_TYPE } from '../consts/Http';
  2. import BaseModel from './BaseModel';
  3. export class MilvusHttp extends BaseModel {
  4. static CONNECT_URL = '/milvus/connect';
  5. static CHECK_URL = '/milvus/check';
  6. static FLUSH_URL = '/milvus/flush';
  7. static TIGGER_CRON_URL = '/crons';
  8. constructor(props: {}) {
  9. super(props);
  10. Object.assign(this, props);
  11. }
  12. static connect(address: string) {
  13. return super.create({ path: this.CONNECT_URL, data: { address } });
  14. }
  15. static check(address: string) {
  16. return super.search({ path: this.CHECK_URL, params: { address } });
  17. }
  18. static flush(collectionName: string) {
  19. return super.update({
  20. path: this.FLUSH_URL,
  21. data: {
  22. collection_names: [collectionName],
  23. },
  24. });
  25. }
  26. static triggerCron(data: { name: WS_EVENTS; type: WS_EVENTS_TYPE }) {
  27. return super.update({
  28. path: this.TIGGER_CRON_URL,
  29. data,
  30. });
  31. }
  32. }