collections.type.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import {
  2. IndexDescription,
  3. CollectionSchema,
  4. FieldSchema,
  5. ReplicaInfo,
  6. KeyValuePair,
  7. DescribeIndexResponse,
  8. DescribeCollectionResponse,
  9. QuerySegmentInfo,
  10. PersistentSegmentInfo,
  11. } from '@zilliz/milvus2-sdk-node';
  12. import { WS_EVENTS, WS_EVENTS_TYPE, LOADING_STATE } from '../utils';
  13. export interface IndexObject extends IndexDescription {
  14. indexType: string;
  15. metricType: string;
  16. indexParameterPairs: KeyValuePair[];
  17. }
  18. export interface FieldObject extends FieldSchema {
  19. index: IndexObject;
  20. // field type params
  21. dimension: number;
  22. maxCapacity: number;
  23. maxLength: number;
  24. }
  25. export interface SchemaObject extends CollectionSchema {
  26. fields: FieldObject[];
  27. primaryField: FieldObject;
  28. vectorFields: FieldObject[];
  29. scalarFields: FieldObject[];
  30. dynamicFields: FieldObject[];
  31. hasVectorIndex: boolean;
  32. enablePartitionKey: boolean;
  33. }
  34. export interface DescribeCollectionRes extends DescribeCollectionResponse {
  35. schema: SchemaObject;
  36. }
  37. export interface DescribeIndexRes extends DescribeIndexResponse {
  38. index_descriptions: IndexObject[];
  39. }
  40. export type CollectionFullObject = {
  41. collection_name: string;
  42. schema: SchemaObject;
  43. rowCount: number;
  44. createdTime: number;
  45. aliases: string[];
  46. description: string;
  47. autoID: boolean;
  48. id: string;
  49. loadedPercentage: number;
  50. consistency_level: string;
  51. replicas: ReplicaInfo[];
  52. status: LOADING_STATE;
  53. loaded: boolean;
  54. properties: KeyValuePair[];
  55. };
  56. export type CollectionLazyObject = {
  57. id: string;
  58. collection_name: string;
  59. status: LOADING_STATE;
  60. schema: undefined;
  61. rowCount: undefined;
  62. createdTime: number;
  63. aliases: undefined;
  64. description: undefined;
  65. autoID: undefined;
  66. loadedPercentage: undefined;
  67. consistency_level: undefined;
  68. replicas: undefined;
  69. loaded: undefined;
  70. properties: undefined;
  71. };
  72. export type CollectionObject = CollectionFullObject | CollectionLazyObject;
  73. export type CountObject = {
  74. rowCount: number;
  75. };
  76. export type StatisticsObject = {
  77. collectionCount: number;
  78. totalData: number;
  79. };
  80. export type QuerySegmentObjects = QuerySegmentInfo[];
  81. export type PersistentSegmentObjects = PersistentSegmentInfo[];
  82. export type CronJobObject = {
  83. name: WS_EVENTS;
  84. type: WS_EVENTS_TYPE;
  85. payload: {
  86. database: string;
  87. collections: string[];
  88. };
  89. };
  90. export type DatabaseObject = {
  91. name: string;
  92. db_name: string;
  93. dbID: string | number;
  94. createdTime: number;
  95. created_timestamp: number;
  96. properties: KeyValuePair[];
  97. collections: string[];
  98. };