collections.type.ts 2.7 KB

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