text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|> translate(${-(alignXToPercent[alignX] ?? 50)}%, ${-(
alignYToPercent[alignY] ?? 50
)}%)`;
}
<|fim_prefix|>const alignXToPercent: Record<'left' | 'center' | 'right', number> = {
left: 0,
center: 50,
right: 100,
};
const alignYToPercent: Record<'top' | 'center' | 'bottom', number> = {
top: 0... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>ceX,
sourceY,
targetX,
targetY,
sourceControlX,
sourceControlY,
targetControlX,
targetControlY,
});
return [
`M${sourceX},${sourceY} C${sourceControlX},${sourceControlY} ${targetControlX},${targetControlY} ${targetX},${targetY}`,
labelX,
labelY,
offsetX,
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { Connection, InternalNodeBase, Transform, errorMessages, isEdgeBase, EdgeBase, ZIndexMode } from '../..';
import type { OnError } from '../../types/general';
import { getOverlappingArea, boxToRect, nodeToBox, getBoundsOfBoxes } from '../general';
// this is used for straight edges and simple smoo... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export * from './bezier-edge';
export * from './straight-e<|fim_suffix|>port * from './smoothstep-edge';
export * from './general';
export * from './positions';
<|fim_middle|>dge';
ex<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|>y,
sourcePosition,
targetPosition,
};
}
function toHandleBounds(handles?: NodeHandle[]) {
if (!handles) {
return null;
}
const source = [];
const target = [];
for (const handle of handles) {
handle.width = handle.width ?? 1;
handle.height = handle.height ?? 1;
if (h... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>ltOffsetX, defaultOffsetY] = getEdgeCenter({
sourceX: source.x,
sourceY: source.y,
targetX: target.x,
targetY: target.y,
});
// opposite handle positions, default case
if (sourceDir[dirAccessor] * targetDir[dirAccessor] === -1) {
if (dirAccessor === 'x') {
// Primary direc... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>getX},${targetY}`, labelX, labelY, offsetX, offsetY];
}
<|fim_prefix|>import { getEdgeCenter } from './general';
export type GetStraightPathParams = {
/** The `x` posi<|fim_middle|>tion of the source handle. */
sourceX: number;
/** The `y` position of the source handle. */
sourceY: number;
/** ... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>= [1, 1]
): XYPosition => {
const position: XYPosition = {
x: (x - tx) / tScale,
y: (y - ty) / tScale,
};
return snapToGrid ? snapPosition(position, snapGrid) : position;
};
export const rendererPointToPoint = ({ x, y }: XYPosition, [tx, ty, tScale]: Transform): XYPosition => {
return {
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>/* eslint-disable @typescript-eslint/no-explicit-any */
import {
boxToRect,
clampPosition,
getBoundsOfBoxes,
getOverlappingArea,
nodeToRect,
pointToRendererPoint,
getViewportForBounds,
isCoordinateExtent,
getNodeDimensions,
nodeToBox,
} from './general';
import {
type Transform,
ty... | fim | xyflow/xyflow | typescript |
export * from './connections';
export * from './dom';
export * from './edges';
export * from './graph';
export * from './general';
export * from './marker';
export * from './node-toolbar';
export * from './edge-toolbar';
export * from './store';
export * from './types';
export * from './shallow-node-data';
<|endoftext|... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import type { EdgeBase, EdgeMarker, EdgeMarkerType, MarkerProps } from '../types';
export function getMarkerId(marker: EdgeMarkerType | undefined, id?: string | null): string {
if (!marker) {
return '';
}
if (typeof marker === 'string') {
return marker;
}
const idPrefix = id ? `${id}_... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { Position, type Rect, type Viewport, type Align } from '../';
export function getNodeToolbarTransform(
nodeRect: Rect,
viewport: Viewport,
position: Posi<|fim_suffix|>eRect.y + nodeRect.height) * viewport.zoom + viewport.y + offset;
shift[1] = 0;
break;
case Position.Left:
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>_b = Array.isArray(b) ? b : [b];
if (_a.length !== _b.length) {
return false;
}
for (let i = 0; i < _a.length; i++) {
if (_a[i].id !== _b[i].id || _a[i].type !== _b[i].type || !Object.is(_a[i].data, _b[i].data)) {
return false;
}
}
return true;
}
<|fim_prefix|>import { NodeB... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>d of the connection
*/
function addConnectionToLookup(
type: 'source' | 'target',
connection: HandleConnection,
connectionKey: string,
connectionLookup: ConnectionLookup,
nodeId: string,
handleId: string | null
) {
/*
* We add the connection to the connectionLookup at the following keys
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>rtial<T>, K> & Omit<T, K>;
export type ParentExpandChild = { id: string; parentId: string; rect: Rect };
<|fim_prefix|>import { Rect } from '../types';
export <|fim_middle|>type Optional<T, K extends keyof T> = Pick<Pa<|endoftext|> | fim | xyflow/xyflow | typescript |
import { drag } from 'd3-drag';
import { select, type Selection } from 'd3-selection';
import {
calcAutoPan,
getEventPosition,
getPointerPosition,
calculateNodePosition,
snapPosition,
getInternalNodesBounds,
rectToBox,
} from '../utils';
import { calculateSnapOffset, getDragItems, getEventHandlerParams, ... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export * from<|fim_suffix|>/XYDrag';
<|fim_middle|> '.<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|>rn [nodesFromDragItems[0], nodesFromDragItems];
}
const node = nodeLookup.get(nodeId)?.internals.userNode;
return [
!node
? nodesFromDragItems[0]
: {
...node,
position: dragItems.get(nodeId)?.position || node.position,
dragging,
},
nodesFro... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>eId,
sourceHandle: isTarget ? handleId : fromHandleId,
target: isTarget ? fromNodeId : handleNodeId,
targetHandle: isTarget ? fromHandleId : handleId,
};
result.connection = connection;
const isConnectable = connectable && connectableEnd;
// in strict mode we don't allo... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>
<|fim_prefix|>export<|fim_middle|> * from './XYHandle';<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import {
ConnectionMode,
type Connection,
type OnConnect,
type OnConnectStart,
type HandleType,
type PanBy,
type Transform,
type Handle,
type OnConnectEnd,
type UpdateConnection,
type IsValidConnection,
NodeLookup,
FinalConnectionState,
NodeBase,
InternalNodeBase,
EdgeBase,... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { getHandlePosition, getOverlappingArea, nodeToRect } from '../utils';
import type { HandleType, XYPosition, Handle, InternalNodeBase, NodeLookup, ConnectionMode } from '../types';
function getNodesWithinDistance(position: XYPosition, nodeLookup: NodeLookup, distance: number): InternalNodeBase[] {... | fim | xyflow/xyflow | typescript |
import { type D3ZoomEvent, zoom } from 'd3-zoom';
import { select, pointer } from 'd3-selection';
import type { CoordinateExtent, PanZoomInstance, Transform } from '../types';
import { isMacOs } from '../utils';
export type XYMinimapInstance = {
update: (params: XYMinimapUpdate) => void;
destroy: () => void;
po... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { type ZoomTransform, zoom, zoomTransform } from 'd3-zoom';
import { select } from 'd3-selection';
import { interpolateZoom, interpolate } from 'd3-interpolate';
import {
type CoordinateExtent,
type Viewport,
PanZoomTransformOptions,
PanZoomUpdateOptions,
PanZoomParams,
PanZoomInstance... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> const viewport = transformToViewport(event.transform);
zoomPanValues.prevViewport = viewport;
clearTimeout(zoomPanValues.timerId);
zoomPanValues.timerId = setTimeout(
() => {
onPanZoomEnd?.(event.sourceEvent as MouseEvent | TouchEvent, viewport);
},
//... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>/* eslint-disable @typescript-eslint/no-explicit-any */
import { isWrappedWithClass } from './utils';
export type FilterParams = {
zoomActivationKeyPressed: boolean;
zoomOnScroll: boolean;
zoomOnPinch: boolean;
panOnDrag: boolean | number[];
panOnScroll: boolean;
zoomOnDoubleClick: boolean;
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export * from './XY<|fim_suffix|>oom';
<|fim_middle|>PanZ<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|> = (event: any) => {
const factor = event.ctrlKey && isMacOs() ? 10 : 1;
return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * factor;
};
<|fim_prefix|>/* eslint-disable @typescript-eslint/no-explicit-any */
import { type ZoomTransform, zoomIdentity } from 'd3-zoom';
/... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { drag } from 'd3-drag';
import { select } from 'd3-selection';
import { getControlDirection, getDimensionsAfterResize, getResizeDirection } from './utils';
import { getPointerPosition, isCoordinateExtent } from '../utils';
import type {
CoordinateExtent,
InternalNodeBase,
NodeBase,
NodeLo... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>r';
<|fim_prefix|>export * from '<|fim_middle|>./types';
export * from './XYResize<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import type { D3DragEvent, SubjectPosition } from 'd3-drag';
/**
* @public
* @inline
*/
export type ResizeParams = {
x: number;
y: number;
width: number;
height: number;
};
export type ResizeParamsWithDirection = ResizeParams & {
direction: number[];
};
/**
* Used to determine the control... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { CoordinateExtent, NodeOrigin } from '../types';
import { getPointerPosition } from '../utils';
import { ControlPosition } from './types';
type GetResizeDirectionParams = {
width: number;
prevWidth: number;
height: number;
prevHeight: number;
affectsX: boolean;
affectsY: boolean;
};
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export const <|fim_suffix|>nv.FRAMEWORK;
<|fim_middle|>FRAMEWORK = process.e<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { test, expect } from '@playwright/test';
import { FRAMEWORK } from './constants';
test.describe('Edges', () => {
test.beforeEach(async ({ page }) => {
// Go to the starting url before each test.
await page.goto('/tests/generic/edges/general');
// Timeout gets ignored and tests tim... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>lbarBox![dimension])).toBe(Math.floor(nodeBox![dimension]));
break;
case 'center':
expect(Math.floor(toolbarBox![dimension] + toolbarBox![extent] * 0.5)).toBe(
Math.floor(nodeBox![dimension] + nodeBox![extent] * 0.5)
);
break;
case 'end':... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>eid="Node-1"]'));
const notConnectableHandle = page
.locator(`.${FRAMEWORK}-flow__handle`)
.and(page.locator('[data-nodeid="notConnectable"]'));
const notConnectableBox = await notConnectableHandle.boundingBox();
await expect(page.locator(`.${FRAMEWORK}-flow__node`).fir... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>cator(`.${FRAMEWORK}-flow__pane`);
const viewport = page.locator(`.${FRAMEWORK}-flow__viewport`);
await expect(pane).toBeAttached();
await pane.hover();
// Zoom out
await page.mouse.wheel(5000, 5000);
const transformsMinZoom = await getTransform(viewport);
exp... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { test, expect } from '@playwright/test';
import { FRAMEWORK } from './constants';
test<|fim_suffix|>ync ({ page }) => {
await page.goto('/examples/color-mode');
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await expect(pag... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>const MATCH_ALL_NUMBERS = /[\d\.]+/g;
// Type "Locator" not exported...
export async function getTransform(element) {
const transformString = await element.evaluate((el) => {
return el.style.transform;
});
// Parses all numbers in f.ex "translate(590px, 324px) scale(2)""
const transforms = t... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { defineConfig } from '@playwright/test';
<|fim_suffix|>({ port: 3000, framework: 'react' }));
<|fim_middle|>import { sharedConfigWithPort } from './playwright.shared.config';
export default defineConfig(sharedConfigWithPort<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { PlaywrightTestConfig, devices } from '@playwright/test';
type ConfigParams = {
port: number;
framework: string;
};
export function sharedConfigWithPort({ port, framework }: ConfigParams): PlaywrightTestConfig {
return {
testDir: './e2e',
/* Run tests in files in parallel */
fu... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { defineConfig } from '@playwright/test';
import { sharedConfigWithPort } from './playwright.shared.config';
export default defineConfig(sharedCo<|fim_suffix|>port: 5173, framework: 'svelte' }));
<|fim_middle|>nfigWithPort({ <|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended<|fim_suffix|>ions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
settings: {
rea... | fim | xyflow/xyflow | javascript |
<|fim_prefix|>require('dotenv').config();
const postcssImport = require('postcss-import');
const postcssNested = require('postcss-nested');
const postcssCombine = require('postcss-combine-duplicated-selectors');
const postcssRename = require('postcss-rename');
const autoprefixer = require('autoprefixe<|fim_suffix|> ... | fim | xyflow/xyflow | javascript |
<|fim_suffix|>ort { resolve } from 'path';
import { cwd } from 'process';
import { defineConfig } from 'rollup';
import resolvePlugin from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
import peerD... | fim | xyflow/xyflow | javascript |
<|fim_prefix|>package controllers
import play.api.i18n.I18nSupport
import play.api.mvc._
import scala.concurrent.ExecutionContext
class ApiHealth(val cc: ControllerComponents)(implicit ec:ExecutionContext) extends AbstractController(cc) with I18nSupport {
de<|fim_suffix|>t:RequestHeader =>
Ok("healthy").withH... | fim | yahoo/CMAK | scala |
<|fim_suffix|>rrorOrClusterList)).withHeaders("X-Frame-Options" -> "SAMEORIGIN")
}
}
}
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package controllers
import features.ApplicationFeatures
import models.navigation.Menus
import... | fim | yahoo/CMAK | scala |
<|fim_prefix|>package controllers
import java.nio.charset.StandardCharsets
import java.security.SecureRandom
import java.util.UUID
import akka.stream.Materializer
import com.typesafe.config.ConfigValueType
import com.unboundid.ldap.sdk._
import com.unboundid.ldap.sdk.extensions.StartTLSExtendedRequest
import com.unbo... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package controllers
import java.util.Properties
import features.{ApplicationFeatures, KMClusterManagerFeature}
import kafka.manager.ApiError
import kafka.manager.features.ClusterFeature... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package controllers
import features.ApplicationFeatures
import models.navigation.Menus
import play.api.i18n.I18nSupport
import play.api.mvc._
import <|fim_suffix|> Ok(views.html.con... | fim | yahoo/CMAK | scala |
<|fim_suffix|>nLifecycle, configuration: Configuration) {
private[this] val kafkaManager : KafkaManager = new KafkaManager(configuration.underlying)
lifecycle.addStopHook { () =>
Future.successful(kafkaManager.shutdown())
}
def getKafkaManager : KafkaManager = kafkaManager
}
<|fim_prefix|>/**
* Copyri... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package controllers
import java.util.Properties
import _root_.features.ApplicationFeatures
import kafka.manager._
import kafka.manager.features.KMLogKafkaFeature
import kafka.manager.mo... | fim | yahoo/CMAK | scala |
<|fim_suffix|>verifying(validateOperation)
)(PreferredReplicaElectionOperation.apply)(PreferredReplicaElectionOperation.unapply)
)
def preferredReplicaElection(c: String) = Action.async { implicit request: RequestHeader =>
kafkaManager.getPreferredLeaderElection(c).map { errorOrStatus =>
Ok(views.htm... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package controllers
import features.{ApplicationFeatures, KMReassignPartitionsFeature}
import kafka.manager.ApiError
import kafka.manager.model.ActorModel._
import models.FollowLink
impo... | fim | yahoo/CMAK | scala |
<|fim_suffix|>p { case (n, h) => (n,TConfig(n,None, Option(h))) }
case Kafka_2_2_1 => TopicConfigs.configNamesAndDoc(Kafka_2_2_1).map { case (n, h) => (n,TConfig(n,None, Option(h))) }
case Kafka_2_2_2 => TopicConfigs.configNamesAndDoc(Kafka_2_2_2).map { case (n, h) => (n,TConfig(n,None, Option(h))) ... | fim | yahoo/CMAK | scala |
<|fim_suffix|>ers("X-Frame-Options" -> "SAMEORIGIN")
)
}
}
}
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package controllers.api
import controllers.KafkaManagerContext
import features.ApplicationFeatures
import kafk... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
import features.{ApplicationFeature, ApplicationFeatures}
import kafka.manager.features.{ClusterFeature, ClusterFeatures}
import kafka.manager.model.ClusterContext
import kafka.manager.{Ap... | fim | yahoo/CMAK | scala |
/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package features
import com.typesafe.config.Config
import grizzled.slf4j.Logging
import kafka.manager.features.KMFeature
import scala.util.{Success, Failure, Try}
sealed trait ApplicationFeature ext... | fim | yahoo/CMAK | scala |
/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
import play.twirl.api.Html
package object features {
val empty: Html = Html("")
def app(f: ApplicationFeature)(content: Html)(implicit af: ApplicationFeatures): Html = {
if(af.features(f))
... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager
import java.util.Properties
import java.util.concurrent.{LinkedBlockingQueue, ThreadPoolExecutor, TimeUnit}
import org.json4s.jackson.JsonMethods.parse
import akka... | fim | yahoo/CMAK | scala |
<|fim_suffix|>ting to clean deleted cluster path : $zkpath")
Try { cleanClusterPath(zkpath) }.flatMap { _ =>
Try {
if(config.curator.checkExists().forPath(zkpath) != null) {
log.info(s"Deleting node $zkpath")
config.curator.delete().deletingC... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.actor
import java.util.Properties
import java.util.concurrent.{LinkedBlockingQueue, ThreadPoolExecutor, TimeUnit}
import akka.actor.{ActorPath, Props}
import akka.... | fim | yahoo/CMAK | scala |
<|fim_suffix|>m.bytesRejectedPerSec,
bm.failedFetchRequestsPerSec,
bm.failedProduceRequestsPerSec,
bm.messagesInPerSec,
bm.oSystemMetrics,
SegmentsMetric(brokerSize)
)
brokerMetrics += (id -> newBm)
}
case any: Any => log.war... | fim | yahoo/CMAK | scala |
<|fim_suffix|>andThreadPoolSize.get, clusterConfig.tuning.get.logkafkaCommandThreadPoolQueueSize.get)
, cmConfig.askTimeoutMillis
, clusterContext)
)
)
)
private[this] val logkafkaCommandActor : Option[ActorPath] =
featureGateFold(KMLogKafkaFeature)(
None,
So... | fim | yahoo/CMAK | scala |
<|fim_suffix|>.2
})
}
}
})
case KCCreateTopic(topic, brokers, partitions, replicationFactor, config) =>
longRunning {
Future {
KCCommandResult(Try {
kafkaCommandActorConfig.adminUtils.createTopic(kafkaCommandActorConfig.curato... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.actor.cluster
import java.io.Closeable
import java.net.InetAddress
import java.nio.ByteBuffer
import java.time.Duration
import java.util
import java.util.Propert... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.actor
import grizzled.slf4j.Logging
import kafka.manager.features.{ClusterFeature, ClusterFeatures}
import org.apache.kafka.common.KafkaFuture.BiConsumer
import sc... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.base
import akka.actor.{Actor, ActorLogging}
import kafka.manager.model.ActorModel
import ActorModel.{ActorErrorResponse, ActorRequest, ActorResponse}
/**
* @auth... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.base
import kafka.manager.model.ActorModel
import ActorModel.{ActorRequest, CommandRequest}
/**
* @author hiral
*/
abstract class BaseCommandActor extends BaseAc... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.base
import kafka.manager.model.ActorModel
import Acto<|fim_suffix|>st: QueryRequest): Unit
@scala.throws[Exception](classOf[Exception])
override def preStart(... | fim | yahoo/CMAK | scala |
<|fim_suffix|>mandActor extends BaseActor {
final def processActorRequest(request: ActorRequest): Unit = {
request match {
case queryRequest: QueryRequest =>
processQueryRequest(queryRequest)
case queryRequest: CommandRequest =>
processCommandRequest(queryRequest)
}
}
def pro... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.base
import akka.actor.ActorLogging
import kafka.manager.model.CuratorConfig
import org.apache.curator.RetrySleeper
import org.apache.curator.framework.{CuratorFram... | fim | yahoo/CMAK | scala |
<|fim_suffix|>.remainingCapacity() >= taskCount
}
@scala.throws[Exception](classOf[Exception])
override def postStop(): Unit = {
log.info("Shutting down long running executor...")
Try(longRunningExecutor.shutdown())
super.postStop()
}
protected def longRunning[T](fn: => Future[T])(implicit ec: E... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.base.cluster
import kafka.manager.base.{BaseQuer<|fim_suffix|>.config
protected implicit lazy val clusterFeatures: ClusterFeatures = clusterContext.clusterFeature... | fim | yahoo/CMAK | scala |
<|fim_suffix|>val obj = runtimeMirror.reflectModule(module)
obj.instance match {
case f: ClusterFeature =>
f
case _ =>
throw new IllegalArgumentException(s"Unknown application feature $s")
}
} match {
case Failure(t) =>
error(... | fim | yahoo/CMAK | scala |
<|fim_suffix|>rocessCpuLoad = {
FormatMetric.rateFormat(processCpuLoad, 0)
}
def formatSystemCpuLoad = {
FormatMetric.rateFormat(systemCpuLoad, 0)
}
}
case class SegmentsMetric(bytes: Long) {
def +(o: SegmentsMetric) : SegmentsMetric = {
SegmentsMetric(o.bytes + bytes)
}
def formatSize = {
... | fim | yahoo/CMAK | scala |
<|fim_suffix|>ason.getMessage, message.getOrElse(""))
super.preRestart(reason, message)
}
@scala.throws[Exception](classOf[Exception])
override def postStop(): Unit = {
super.postStop()
}
override protected def longRunningPoolConfig: LongRunningPoolConfig = logkafkaCommandActorConfig.longRunningPool... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.logkafka
import kafka.manager.model.{ClusterContext, ActorModel}
import ActorModel._
import kafka.manager._
import kafka.manager.base.BaseQueryCommandActor
import k... | fim | yahoo/CMAK | scala |
<|fim_suffix|>: Received unknown message: {}", any)
}
}
override def processActorResponse(response: ActorResponse): Unit = {
response match {
case lcg: LogkafkaConfigs =>
logkafkaConfigsOption = Some(lcg)
updateView()
case lct: LogkafkaClients =>
logkafkaClientsOption =... | fim | yahoo/CMAK | scala |
<|fim_suffix|>y] {
def write(ti: TopicIdentity) =
makeObj(("topic" -> toJSON(ti.topic))
:: ("readVersion" -> toJSON(ti.readVersion))
:: ("partitions" -> toJSON(ti.partitions))
:: ("partitionsIdentity" -> Extraction.decompose(ti.partitionsIdentity.values.toList.sortBy(_.partNu... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.model
import java.nio.charset.StandardCharsets
import kafka.manager.features.ClusterFeatures
import scala.util.Try
import scala.util.matching.Regex
import scalaz.... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager
import org.json4s._
import org.json4s.scalaz.JsonScalaz._
package object model {
def fieldExtended[A: JSONR](name: String)(json: JValue): Result[A] = {
val re... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka
import java.nio.charset.StandardCharsets
import kafka.manager.features.{ClusterFeatures, ClusterFeature}
/**
* @author hiral
*/
package object manager {
def nodeFrom... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "Lice... | fim | yahoo/CMAK | scala |
<|fim_suffix|> get config names and doc")
}
}
}
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.utils
import java.util.Properties
import kafka.manager.model.{KafkaVersion, Kafka_0_10_1_1}
trait Brok... | fim | yahoo/CMAK | scala |
<|fim_suffix|>Exception(error.toString)
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See<|fim_middle|> accompanying LICENSE file.
*/
package kafka.manager.utils
/**
* @author hiral
*/
abstract class UtilError(msg: String) {
override def toString : String = ms... | fim | yahoo/CMAK | scala |
<|fim_prefix|>package kafka.manager.utils
import scala.coll<|fim_suffix|>ret
}
}<|fim_middle|>ection.immutable.Queue
class FiniteQueue[A](q: Queue[A]) {
def enqueueFinite[B >: A](elem: B, maxSize: Int): Queue[B] = {
var ret = q.enqueue(elem)
while (ret.size > maxSize) {
ret = ret.dequeue._2
}
... | fim | yahoo/CMAK | scala |
<|fim_suffix|>port play.api.data.Field
def apply(field: play.api.data.Field, min: Int = 1)(f: (Field,Int) => Html) = {
(0 until math.max(if (field.indexes.isEmpty) 0 else field.indexes.max + 1, min)).map(i => f(field("[" + i + "]"),i))
}
}
<|fim_prefix|>package kafka.manager.utils
import play.t<|fim_middle|>w... | fim | yahoo/CMAK | scala |
<|fim_suffix|>(
"log path " + log_path + " is illegal, contains a character in " + Logkafka.illegalPathChars)
class HostnameNotExists private[LogkafkaErrors] (hostname: String) extends UtilError(s"Hostname not exists : $hostname")
class LogkafkaIdNotExists private[LogkafkaErrors] (logkafka_id: String) extends U... | fim | yahoo/CMAK | scala |
<|fim_suffix|>ath(curator, LogkafkaZkUtils.getLogkafkaConfigPath(logkafka_id), toJson(configMap), readVersion)
}
}
<|fim_prefix|>/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information re... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*/
package kafka.manager.utils
import java.util.Properties
import kafka.manager.model.{Kafka_1_0_0, _}
trait LogkafkaNewConfigs {
def configNames : Set[String]
def configMaps: Map[Str... | fim | yahoo/CMAK | scala |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | fim | yahoo/CMAK | scala |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | fim | yahoo/CMAK | scala |
<|fim_suffix|>ogConfig,
Kafka_3_1_1 -> two40.LogConfig,
Kafka_3_2_0 -> two40.LogConfig
)
def configNames(version: KafkaVersion): Seq[String] = {
topicConfigsByVersion.get(version) match {
case Some(tc) => tc.configNames
case None => throw new IllegalArgumentException(s"Undefined topic confi... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "Lice... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "Lice... | fim | yahoo/CMAK | scala |
<|fim_suffix|>iter,
val topic: String = Defaults.Topic,
val key: String = Defaults.Key,
val partition: Int = Defaults.Partition,
val compressionCodec: String = Defaults.CompressionCodec,
val requiredAcks: Int = Defa... | fim | yahoo/CMAK | scala |
<|fim_suffix|>nal offset commit. This is called after a commit or abort marker is fully written
* to the log.
*/
def completePendingTxnOffsetCommit(producerId: Long, isCommit: Boolean): Unit = {
val pendingOffsetsOpt = pendingTransactionalOffsetCommits.remove(producerId)
if (isCommit) {
pendingOff... | fim | yahoo/CMAK | scala |
<|fim_prefix|>/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the ... | fim | yahoo/CMAK | scala |
<|fim_suffix|>the metadata if the
* member has sent the join group request
* 2. Awaiting sync callback: when the group is in the awaiting-sync state, its sync callback
* is kept in metadata until the leader provides the group assignment
* ... | fim | yahoo/CMAK | scala |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.