Skip to content

Commit

Permalink
Refactor state types
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Sep 28, 2021
1 parent 618d1e5 commit 6a5123a
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import * as TaskEither from 'fp-ts/lib/TaskEither';
import type { TransformRawDocs } from '../types';
import type { TransformRawDocs } from '../state';
import type { SavedObjectsRawDoc } from '../../serialization';
import {
DocumentsTransformFailed,
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/saved_objects/migrationsv2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ElasticsearchClient } from '../../elasticsearch';
import { IndexMapping } from '../mappings';
import { Logger } from '../../logging';
import type { SavedObjectsMigrationVersion } from '../types';
import type { TransformRawDocs } from './types';
import type { TransformRawDocs } from './state';
import { MigrationResult } from '../migrations/core';
import { next } from './next';
import { model } from './model';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IndexMapping } from '../mappings';
import { SavedObjectsMigrationVersion } from '../../../types';
import { SavedObjectsMigrationConfigType } from '../saved_objects_config';
import type { ISavedObjectTypeRegistry } from '../saved_objects_type_registry';
import { InitState } from './types';
import { InitState } from './state';
import { excludeUnusedTypesQuery } from '../migrations/core';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as Option from 'fp-ts/lib/Option';
import { ResponseError } from '@elastic/elasticsearch/lib/errors';
import { elasticsearchClientMock } from '../../elasticsearch/client/mocks';
import { LoggerAdapter } from '../../logging/logger_adapter';
import { AllControlStates, State } from './types';
import { AllControlStates, State } from './state';
import { createInitialState } from './initial_state';
import { ByteSizeValue } from '@kbn/config-schema';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { ElasticsearchClient } from '../../elasticsearch';
import { getErrorMessage, getRequestDebugMeta } from '../../elasticsearch';
import { Model, Next, stateActionMachine } from './state_action_machine';
import { cleanup } from './migrations_state_machine_cleanup';
import { ReindexSourceToTempTransform, ReindexSourceToTempIndexBulk, State } from './types';
import { ReindexSourceToTempTransform, ReindexSourceToTempIndexBulk, State } from './state';
import { SavedObjectsRawDoc } from '../serialization';

interface StateTransitionLogMeta extends LogMeta {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import type { ElasticsearchClient } from '../../elasticsearch';
import * as Actions from './actions';
import type { State } from './types';
import type { State } from './state';

export async function cleanup(client: ElasticsearchClient, state?: State) {
if (!state) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { gt, valid } from 'semver';
import { State } from '../types';
import { State } from '../state';
import { IndexMapping } from '../../mappings';
import { FetchIndexResponse } from '../actions';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import type {
ReindexSourceToTempIndexBulk,
CheckUnknownDocumentsState,
CalculateExcludeFiltersState,
} from '../types';
} from '../state';
import { SavedObjectsRawDoc } from '../../serialization';
import { TransformErrorObjects, TransformSavedObjectDocumentError } from '../../migrations/core';
import { AliasAction, RetryableEsClientError } from '../actions';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/saved_objects/migrationsv2/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as Option from 'fp-ts/lib/Option';

import { estypes } from '@elastic/elasticsearch';
import { AliasAction, isLeftTypeof } from '../actions';
import { AllActionStates, MigrationLog, State } from '../types';
import { AllActionStates, MigrationLog, State } from '../state';
import type { ResponseType } from '../next';
import { disableUnknownTypeMappingFields } from '../../migrations/core/migration_context';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import type { MigrationLog } from '../types';
import type { MigrationLog } from '../state';
import {
createInitialProgress,
incrementProcessedProgress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import type { MigrationLog, Progress } from '../types';
import type { MigrationLog, Progress } from '../state';

/**
* Returns an initial state of the progress object (everything undefined)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { resetRetryState, delayRetryState } from './retry_state';
import { State } from '../types';
import { State } from '../state';

const createState = (parts: Record<string, any>) => {
return parts as State;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { State } from '../types';
import { State } from '../state';

export const delayRetryState = <S extends State>(
state: S,
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/saved_objects/migrationsv2/next.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { ElasticsearchClient } from '../../elasticsearch';
import { next } from './next';
import { State } from './types';
import { State } from './state';

describe('migrations v2 next', () => {
it.todo('when state.retryDelay > 0 delays execution of the next action');
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/saved_objects/migrationsv2/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import type {
OutdatedDocumentsRefresh,
CheckUnknownDocumentsState,
CalculateExcludeFiltersState,
} from './types';
} from './state';
import * as Actions from './actions';
import { ElasticsearchClient } from '../../elasticsearch';

Expand Down

0 comments on commit 6a5123a

Please sign in to comment.