├── .github └── workflows │ ├── ISSUE_TEMPLATE.md │ ├── PULL_REQUEST_TEMPLATE.md │ ├── check_label.yml │ ├── doxygen.yml │ ├── pull_request.yml │ ├── release.yaml │ └── snapshot.yaml ├── .gitignore ├── .mvn └── wrapper │ └── maven-wrapper.properties ├── .travis.yml ├── LICENSE ├── LICENSES └── Apache-2.0.txt ├── README.md ├── checkstyle-suppressions.xml ├── client ├── pom.xml └── src │ ├── main │ ├── fbthrift │ │ └── com │ │ │ └── facebook │ │ │ └── thrift │ │ │ ├── EncodingUtils.java │ │ │ ├── EventHandlerBase.java │ │ │ ├── IntRangeSet.java │ │ │ ├── MultipleTProcessorEventHandlers.java │ │ │ ├── ShortStack.java │ │ │ ├── TApplicationException.java │ │ │ ├── TBase.java │ │ │ ├── TBaseHelper.java │ │ │ ├── TByteArrayOutputStream.java │ │ │ ├── TClientIf.java │ │ │ ├── TDeserializeUtils.java │ │ │ ├── TDeserializer.java │ │ │ ├── TEnum.java │ │ │ ├── TException.java │ │ │ ├── TFieldIdEnum.java │ │ │ ├── TFieldRequirementType.java │ │ │ ├── TMultiplexedProcessor.java │ │ │ ├── TProcessor.java │ │ │ ├── TProcessorEventHandler.java │ │ │ ├── TProcessorFactory.java │ │ │ ├── TSerializer.java │ │ │ ├── TServiceClient.java │ │ │ ├── TUnion.java │ │ │ ├── UserExceptionHandler.java │ │ │ ├── annotations │ │ │ └── Sensitive.java │ │ │ ├── async │ │ │ ├── AsyncMethodCallback.java │ │ │ ├── TAsyncClient.java │ │ │ ├── TAsyncClientFactory.java │ │ │ ├── TAsyncClientManager.java │ │ │ └── TAsyncMethodCall.java │ │ │ ├── meta_data │ │ │ ├── FieldMetaData.java │ │ │ ├── FieldValueMetaData.java │ │ │ ├── ListMetaData.java │ │ │ ├── MapMetaData.java │ │ │ ├── SetMetaData.java │ │ │ └── StructMetaData.java │ │ │ ├── protocol │ │ │ ├── TBase64Utils.java │ │ │ ├── TBinaryProtocol.java │ │ │ ├── TCompactJSONProtocol.java │ │ │ ├── TCompactProtocol.java │ │ │ ├── TField.java │ │ │ ├── THeaderProtocol.java │ │ │ ├── TJSONProtocol.java │ │ │ ├── TJSONProtocolBase.java │ │ │ ├── TList.java │ │ │ ├── TMap.java │ │ │ ├── TMessage.java │ │ │ ├── TMessageType.java │ │ │ ├── TMultiplexedProtocol.java │ │ │ ├── TProtocol.java │ │ │ ├── TProtocolDecorator.java │ │ │ ├── TProtocolException.java │ │ │ ├── TProtocolFactory.java │ │ │ ├── TProtocolUtil.java │ │ │ ├── TSet.java │ │ │ ├── TSimpleJSONProtocol.java │ │ │ ├── TStruct.java │ │ │ ├── TTupleProtocol.java │ │ │ └── TType.java │ │ │ ├── scheme │ │ │ ├── IScheme.java │ │ │ ├── SchemeFactory.java │ │ │ ├── StandardScheme.java │ │ │ └── TupleScheme.java │ │ │ ├── server │ │ │ ├── TConnectionContext.java │ │ │ ├── THsHaServer.java │ │ │ ├── TNonblockingServer.java │ │ │ ├── TRpcConnectionContext.java │ │ │ ├── TServer.java │ │ │ ├── TServlet.java │ │ │ ├── TThreadFactoryImpl.java │ │ │ └── example │ │ │ │ ├── TSimpleServer.java │ │ │ │ └── TThreadPoolServer.java │ │ │ ├── transport │ │ │ ├── OkHttp3Util.java │ │ │ ├── TFramedTransport.java │ │ │ ├── THeaderException.java │ │ │ ├── THeaderTransport.java │ │ │ ├── THttp2Client.java │ │ │ ├── THttpClient.java │ │ │ ├── TIOStreamTransport.java │ │ │ ├── TMemoryBuffer.java │ │ │ ├── TMemoryInputTransport.java │ │ │ ├── TNonblockingServerSocket.java │ │ │ ├── TNonblockingServerTransport.java │ │ │ ├── TNonblockingSocket.java │ │ │ ├── TNonblockingTransport.java │ │ │ ├── TServerSocket.java │ │ │ ├── TServerTransport.java │ │ │ ├── TSocket.java │ │ │ ├── TSocketIf.java │ │ │ ├── TTransport.java │ │ │ ├── TTransportException.java │ │ │ └── TTransportFactory.java │ │ │ └── utils │ │ │ ├── ByteBufferUtils.java │ │ │ ├── Logger.java │ │ │ └── StandardCharsets.java │ ├── generated │ │ ├── AppendLogRequest.java │ │ ├── AppendLogResponse.java │ │ ├── AskForVoteRequest.java │ │ ├── AskForVoteResponse.java │ │ ├── EndSendCheckpointResponse.java │ │ ├── GetStateRequest.java │ │ ├── GetStateResponse.java │ │ ├── HeartbeatRequest.java │ │ ├── HeartbeatResponse.java │ │ ├── RaftLogEntry.java │ │ ├── RaftexService.java │ │ ├── Role.java │ │ ├── SendCheckpointRequest.java │ │ ├── SendSnapshotRequest.java │ │ ├── SendSnapshotResponse.java │ │ ├── StartSendCheckpointResponse.java │ │ ├── Status.java │ │ └── com │ │ │ └── vesoft │ │ │ └── nebula │ │ │ ├── CheckpointInfo.java │ │ │ ├── Constants.java │ │ │ ├── Coordinate.java │ │ │ ├── DataSet.java │ │ │ ├── Date.java │ │ │ ├── DateTime.java │ │ │ ├── DirInfo.java │ │ │ ├── Duration.java │ │ │ ├── Edge.java │ │ │ ├── ErrorCode.java │ │ │ ├── Geography.java │ │ │ ├── HostAddr.java │ │ │ ├── KeyValue.java │ │ │ ├── LineString.java │ │ │ ├── LogEntry.java │ │ │ ├── LogInfo.java │ │ │ ├── NList.java │ │ │ ├── NMap.java │ │ │ ├── NSet.java │ │ │ ├── NullType.java │ │ │ ├── Path.java │ │ │ ├── Point.java │ │ │ ├── Polygon.java │ │ │ ├── PropertyType.java │ │ │ ├── Row.java │ │ │ ├── SchemaID.java │ │ │ ├── Step.java │ │ │ ├── SyncInfo.java │ │ │ ├── SyncStatus.java │ │ │ ├── Tag.java │ │ │ ├── Time.java │ │ │ ├── Value.java │ │ │ ├── Vertex.java │ │ │ ├── drainer │ │ │ ├── AppendLogRequest.java │ │ │ ├── AppendLogResponse.java │ │ │ ├── DrainerService.java │ │ │ ├── GetSyncProgressReq.java │ │ │ └── GetSyncProgressResp.java │ │ │ ├── graph │ │ │ ├── AuthResponse.java │ │ │ ├── ExecutionResponse.java │ │ │ ├── GraphService.java │ │ │ ├── HealthResp.java │ │ │ ├── Pair.java │ │ │ ├── PlanDescription.java │ │ │ ├── PlanNodeBranchInfo.java │ │ │ ├── PlanNodeDescription.java │ │ │ ├── ProfilingStats.java │ │ │ ├── VerifyClientVersionReq.java │ │ │ └── VerifyClientVersionResp.java │ │ │ ├── meta │ │ │ ├── AddDrainerReq.java │ │ │ ├── AddHostsIntoZoneReq.java │ │ │ ├── AddHostsReq.java │ │ │ ├── AddListenerReq.java │ │ │ ├── AdminJobReq.java │ │ │ ├── AdminJobResp.java │ │ │ ├── AdminJobResult.java │ │ │ ├── AgentHBReq.java │ │ │ ├── AgentHBResp.java │ │ │ ├── AlterEdgeReq.java │ │ │ ├── AlterSchemaItem.java │ │ │ ├── AlterSchemaOp.java │ │ │ ├── AlterSpaceOp.java │ │ │ ├── AlterSpaceReq.java │ │ │ ├── AlterTagReq.java │ │ │ ├── AlterUserPrivilegeReq.java │ │ │ ├── AlterUserReq.java │ │ │ ├── BackupMeta.java │ │ │ ├── BalanceTask.java │ │ │ ├── ChangeMetaReq.java │ │ │ ├── ChangeMetaResp.java │ │ │ ├── ChangePasswordReq.java │ │ │ ├── ClearSpaceReq.java │ │ │ ├── ColumnDef.java │ │ │ ├── ColumnTypeDef.java │ │ │ ├── ConfigItem.java │ │ │ ├── ConfigMode.java │ │ │ ├── ConfigModule.java │ │ │ ├── Correlativity.java │ │ │ ├── CreateBackupReq.java │ │ │ ├── CreateBackupResp.java │ │ │ ├── CreateEdgeIndexReq.java │ │ │ ├── CreateEdgeReq.java │ │ │ ├── CreateFTIndexReq.java │ │ │ ├── CreateSessionReq.java │ │ │ ├── CreateSessionResp.java │ │ │ ├── CreateSnapshotReq.java │ │ │ ├── CreateSpaceAsReq.java │ │ │ ├── CreateSpaceReq.java │ │ │ ├── CreateTagIndexReq.java │ │ │ ├── CreateTagReq.java │ │ │ ├── CreateUserReq.java │ │ │ ├── DivideZoneReq.java │ │ │ ├── DrainerClientInfo.java │ │ │ ├── DrainerInfo.java │ │ │ ├── DropEdgeIndexReq.java │ │ │ ├── DropEdgeReq.java │ │ │ ├── DropFTIndexReq.java │ │ │ ├── DropHostsReq.java │ │ │ ├── DropSnapshotReq.java │ │ │ ├── DropSpaceReq.java │ │ │ ├── DropTagIndexReq.java │ │ │ ├── DropTagReq.java │ │ │ ├── DropUserReq.java │ │ │ ├── DropZoneReq.java │ │ │ ├── EdgeItem.java │ │ │ ├── ExecResp.java │ │ │ ├── ExternalServiceType.java │ │ │ ├── ExternalSpaceServiceType.java │ │ │ ├── FTIndex.java │ │ │ ├── GeoShape.java │ │ │ ├── GetConfigReq.java │ │ │ ├── GetConfigResp.java │ │ │ ├── GetEdgeIndexReq.java │ │ │ ├── GetEdgeIndexResp.java │ │ │ ├── GetEdgeReq.java │ │ │ ├── GetEdgeResp.java │ │ │ ├── GetLicenseReq.java │ │ │ ├── GetLicenseResp.java │ │ │ ├── GetMetaDirInfoReq.java │ │ │ ├── GetMetaDirInfoResp.java │ │ │ ├── GetPartsAllocReq.java │ │ │ ├── GetPartsAllocResp.java │ │ │ ├── GetSegmentIdReq.java │ │ │ ├── GetSegmentIdResp.java │ │ │ ├── GetSessionReq.java │ │ │ ├── GetSessionResp.java │ │ │ ├── GetSpaceReq.java │ │ │ ├── GetSpaceResp.java │ │ │ ├── GetStatsReq.java │ │ │ ├── GetStatsResp.java │ │ │ ├── GetSyncProgressReq.java │ │ │ ├── GetSyncProgressResp.java │ │ │ ├── GetTagIndexReq.java │ │ │ ├── GetTagIndexResp.java │ │ │ ├── GetTagReq.java │ │ │ ├── GetTagResp.java │ │ │ ├── GetUserRolesReq.java │ │ │ ├── GetVariableReq.java │ │ │ ├── GetVariableResp.java │ │ │ ├── GetWorkerIdReq.java │ │ │ ├── GetWorkerIdResp.java │ │ │ ├── GetZoneReq.java │ │ │ ├── GetZoneResp.java │ │ │ ├── GrantRoleReq.java │ │ │ ├── HBReq.java │ │ │ ├── HBResp.java │ │ │ ├── HostBackupInfo.java │ │ │ ├── HostItem.java │ │ │ ├── HostPair.java │ │ │ ├── HostRole.java │ │ │ ├── HostStatus.java │ │ │ ├── ID.java │ │ │ ├── IdName.java │ │ │ ├── IndexFieldDef.java │ │ │ ├── IndexItem.java │ │ │ ├── IndexParams.java │ │ │ ├── IndexStatus.java │ │ │ ├── IsolationLevel.java │ │ │ ├── JobDesc.java │ │ │ ├── JobOp.java │ │ │ ├── JobStatus.java │ │ │ ├── JobType.java │ │ │ ├── KillQueryReq.java │ │ │ ├── LeaderInfo.java │ │ │ ├── ListClusterInfoReq.java │ │ │ ├── ListClusterInfoResp.java │ │ │ ├── ListConfigsReq.java │ │ │ ├── ListConfigsResp.java │ │ │ ├── ListDrainerSyncStatusReq.java │ │ │ ├── ListDrainerSyncStatusResp.java │ │ │ ├── ListDrainersReq.java │ │ │ ├── ListDrainersResp.java │ │ │ ├── ListEdgeIndexesReq.java │ │ │ ├── ListEdgeIndexesResp.java │ │ │ ├── ListEdgesReq.java │ │ │ ├── ListEdgesResp.java │ │ │ ├── ListFTIndexesReq.java │ │ │ ├── ListFTIndexesResp.java │ │ │ ├── ListHostType.java │ │ │ ├── ListHostsReq.java │ │ │ ├── ListHostsResp.java │ │ │ ├── ListIndexStatusReq.java │ │ │ ├── ListIndexStatusResp.java │ │ │ ├── ListIpWhitelistsReq.java │ │ │ ├── ListIpWhitelistsResp.java │ │ │ ├── ListListenerDrainersReq.java │ │ │ ├── ListListenerDrainersResp.java │ │ │ ├── ListListenersReq.java │ │ │ ├── ListListenersResp.java │ │ │ ├── ListMetaReq.java │ │ │ ├── ListMetaResp.java │ │ │ ├── ListPartsReq.java │ │ │ ├── ListPartsResp.java │ │ │ ├── ListRolesReq.java │ │ │ ├── ListRolesResp.java │ │ │ ├── ListServiceClientsReq.java │ │ │ ├── ListServiceClientsResp.java │ │ │ ├── ListSessionsReq.java │ │ │ ├── ListSessionsResp.java │ │ │ ├── ListSnapshotsReq.java │ │ │ ├── ListSnapshotsResp.java │ │ │ ├── ListSpaceServiceClientsReq.java │ │ │ ├── ListSpaceServiceClientsResp.java │ │ │ ├── ListSpacesReq.java │ │ │ ├── ListSpacesResp.java │ │ │ ├── ListSyncStatusReq.java │ │ │ ├── ListSyncStatusResp.java │ │ │ ├── ListTagIndexesReq.java │ │ │ ├── ListTagIndexesResp.java │ │ │ ├── ListTagsReq.java │ │ │ ├── ListTagsResp.java │ │ │ ├── ListUserPrivilegeReq.java │ │ │ ├── ListUserPrivilegeResp.java │ │ │ ├── ListUsersReq.java │ │ │ ├── ListUsersResp.java │ │ │ ├── ListVariablesReq.java │ │ │ ├── ListVariablesResp.java │ │ │ ├── ListZonesReq.java │ │ │ ├── ListZonesResp.java │ │ │ ├── ListenerInfo.java │ │ │ ├── ListenerType.java │ │ │ ├── MergeZoneReq.java │ │ │ ├── MetaService.java │ │ │ ├── PartInfo.java │ │ │ ├── PartItem.java │ │ │ ├── PartitionList.java │ │ │ ├── Privilege.java │ │ │ ├── PrivilegeEdge.java │ │ │ ├── PrivilegeSchema.java │ │ │ ├── PrivilegeTag.java │ │ │ ├── QueryDesc.java │ │ │ ├── QueryStatus.java │ │ │ ├── RebuildIndexReq.java │ │ │ ├── RegConfigReq.java │ │ │ ├── RemoveDrainerReq.java │ │ │ ├── RemoveListenerReq.java │ │ │ ├── RemoveSessionReq.java │ │ │ ├── RemoveSessionResp.java │ │ │ ├── RenameZoneReq.java │ │ │ ├── ReportTaskReq.java │ │ │ ├── RestartSyncReq.java │ │ │ ├── RestoreMetaReq.java │ │ │ ├── RestoreMetaResp.java │ │ │ ├── RevokeRoleReq.java │ │ │ ├── RoleItem.java │ │ │ ├── RoleType.java │ │ │ ├── SaveGraphVersionReq.java │ │ │ ├── SaveGraphVersionResp.java │ │ │ ├── Schema.java │ │ │ ├── SchemaProp.java │ │ │ ├── ServiceClient.java │ │ │ ├── ServiceInfo.java │ │ │ ├── Session.java │ │ │ ├── SetConfigReq.java │ │ │ ├── SetVariableReq.java │ │ │ ├── SignInServiceReq.java │ │ │ ├── SignInSpaceServiceReq.java │ │ │ ├── SignOutServiceReq.java │ │ │ ├── SignOutSpaceServiceReq.java │ │ │ ├── Snapshot.java │ │ │ ├── SnapshotStatus.java │ │ │ ├── SpaceBackupInfo.java │ │ │ ├── SpaceDesc.java │ │ │ ├── SpaceItem.java │ │ │ ├── StatsItem.java │ │ │ ├── StopSyncReq.java │ │ │ ├── SyncDataReq.java │ │ │ ├── TagItem.java │ │ │ ├── TaskDesc.java │ │ │ ├── TaskResult.java │ │ │ ├── UpdateSessionsReq.java │ │ │ ├── UpdateSessionsResp.java │ │ │ ├── UserItem.java │ │ │ ├── VariableItem.java │ │ │ ├── VerifyClientVersionReq.java │ │ │ ├── VerifyClientVersionResp.java │ │ │ └── Zone.java │ │ │ └── storage │ │ │ ├── AddEdgesRequest.java │ │ │ ├── AddLearnerReq.java │ │ │ ├── AddPartReq.java │ │ │ ├── AddTaskRequest.java │ │ │ ├── AddTaskResp.java │ │ │ ├── AddVerticesRequest.java │ │ │ ├── AdminExecResp.java │ │ │ ├── BlockingSignRequest.java │ │ │ ├── BlockingSignResp.java │ │ │ ├── CatchUpDataReq.java │ │ │ ├── CatchUpResp.java │ │ │ ├── CatchUpStatus.java │ │ │ ├── ChainAddEdgesRequest.java │ │ │ ├── ChainDeleteEdgesRequest.java │ │ │ ├── ChainUpdateEdgeRequest.java │ │ │ ├── CheckPeersReq.java │ │ │ ├── ClearSpaceReq.java │ │ │ ├── ClearSpaceResp.java │ │ │ ├── CreateCPRequest.java │ │ │ ├── CreateCPResp.java │ │ │ ├── DelTags.java │ │ │ ├── DeleteEdgesRequest.java │ │ │ ├── DeleteTagsRequest.java │ │ │ ├── DeleteVerticesRequest.java │ │ │ ├── DropCPRequest.java │ │ │ ├── DropCPResp.java │ │ │ ├── EdgeDirection.java │ │ │ ├── EdgeKey.java │ │ │ ├── EdgeProp.java │ │ │ ├── EngineSignType.java │ │ │ ├── ExecResponse.java │ │ │ ├── Expr.java │ │ │ ├── GetDstBySrcRequest.java │ │ │ ├── GetDstBySrcResponse.java │ │ │ ├── GetLeaderPartsResp.java │ │ │ ├── GetLeaderReq.java │ │ │ ├── GetNeighborsRequest.java │ │ │ ├── GetNeighborsResponse.java │ │ │ ├── GetPropRequest.java │ │ │ ├── GetPropResponse.java │ │ │ ├── GetSyncProgressReq.java │ │ │ ├── GetSyncProgressResp.java │ │ │ ├── GetUUIDReq.java │ │ │ ├── GetUUIDResp.java │ │ │ ├── GraphStorageService.java │ │ │ ├── IndexColumnHint.java │ │ │ ├── IndexQueryContext.java │ │ │ ├── IndexSpec.java │ │ │ ├── InternalStorageService.java │ │ │ ├── InternalTxnRequest.java │ │ │ ├── KVAppendRequest.java │ │ │ ├── KVGetRequest.java │ │ │ ├── KVGetResponse.java │ │ │ ├── KVPutRequest.java │ │ │ ├── KVRemoveRequest.java │ │ │ ├── ListClusterInfoReq.java │ │ │ ├── ListClusterInfoResp.java │ │ │ ├── LookupAndTraverseRequest.java │ │ │ ├── LookupIndexRequest.java │ │ │ ├── LookupIndexResp.java │ │ │ ├── MemberChangeReq.java │ │ │ ├── NewEdge.java │ │ │ ├── NewTag.java │ │ │ ├── NewVertex.java │ │ │ ├── OrderBy.java │ │ │ ├── OrderDirection.java │ │ │ ├── PartitionResult.java │ │ │ ├── RebuildIndexRequest.java │ │ │ ├── RemovePartReq.java │ │ │ ├── RequestCommon.java │ │ │ ├── ResponseCommon.java │ │ │ ├── ScanCursor.java │ │ │ ├── ScanEdgeRequest.java │ │ │ ├── ScanResponse.java │ │ │ ├── ScanType.java │ │ │ ├── ScanVertexRequest.java │ │ │ ├── StatProp.java │ │ │ ├── StatType.java │ │ │ ├── StopTaskRequest.java │ │ │ ├── StopTaskResp.java │ │ │ ├── StorageAdminService.java │ │ │ ├── SyncDataRequest.java │ │ │ ├── TaskPara.java │ │ │ ├── TransLeaderReq.java │ │ │ ├── TraverseSpec.java │ │ │ ├── UpdateEdgeRequest.java │ │ │ ├── UpdateResponse.java │ │ │ ├── UpdateVertexRequest.java │ │ │ ├── UpdatedProp.java │ │ │ └── VertexProp.java │ └── java │ │ └── com │ │ └── vesoft │ │ └── nebula │ │ ├── client │ │ ├── graph │ │ │ ├── NebulaPoolConfig.java │ │ │ ├── NebulaSession.java │ │ │ ├── SessionPool.java │ │ │ ├── SessionPoolConfig.java │ │ │ ├── SessionsManagerConfig.java │ │ │ ├── data │ │ │ │ ├── BaseDataObject.java │ │ │ │ ├── CASignedSSLParam.java │ │ │ │ ├── CoordinateWrapper.java │ │ │ │ ├── DateTimeWrapper.java │ │ │ │ ├── DateWrapper.java │ │ │ │ ├── DurationWrapper.java │ │ │ │ ├── GeographyWrapper.java │ │ │ │ ├── HostAddress.java │ │ │ │ ├── LineStringWrapper.java │ │ │ │ ├── Node.java │ │ │ │ ├── PathWrapper.java │ │ │ │ ├── PointWrapper.java │ │ │ │ ├── PolygonWrapper.java │ │ │ │ ├── Relationship.java │ │ │ │ ├── ResultSet.java │ │ │ │ ├── SSLParam.java │ │ │ │ ├── SelfSignedSSLParam.java │ │ │ │ ├── TimeUtil.java │ │ │ │ ├── TimeWrapper.java │ │ │ │ └── ValueWrapper.java │ │ │ ├── exception │ │ │ │ ├── AuthFailedException.java │ │ │ │ ├── BindSpaceFailedException.java │ │ │ │ ├── ClientServerIncompatibleException.java │ │ │ │ ├── IOErrorException.java │ │ │ │ ├── InvalidConfigException.java │ │ │ │ ├── InvalidSessionException.java │ │ │ │ ├── InvalidValueException.java │ │ │ │ └── NotValidConnectionException.java │ │ │ └── net │ │ │ │ ├── AuthResult.java │ │ │ │ ├── ConnObjectPool.java │ │ │ │ ├── Connection.java │ │ │ │ ├── LoadBalancer.java │ │ │ │ ├── NebulaPool.java │ │ │ │ ├── RoundRobinLoadBalancer.java │ │ │ │ ├── Session.java │ │ │ │ ├── SessionState.java │ │ │ │ ├── SessionWrapper.java │ │ │ │ ├── SessionsManager.java │ │ │ │ └── SyncConnection.java │ │ ├── meta │ │ │ ├── AbstractMetaClient.java │ │ │ ├── MetaCache.java │ │ │ ├── MetaClient.java │ │ │ ├── MetaManager.java │ │ │ └── exception │ │ │ │ └── ExecuteFailedException.java │ │ └── storage │ │ │ ├── GraphStorageConnection.java │ │ │ ├── StorageClient.java │ │ │ ├── StorageConnPool.java │ │ │ ├── StorageConnPoolFactory.java │ │ │ ├── StoragePoolConfig.java │ │ │ ├── data │ │ │ ├── BaseTableRow.java │ │ │ ├── EdgeRow.java │ │ │ ├── EdgeTableRow.java │ │ │ ├── ScanStatus.java │ │ │ ├── VertexRow.java │ │ │ └── VertexTableRow.java │ │ │ ├── processor │ │ │ ├── EdgeProcessor.java │ │ │ └── VertexProcessor.java │ │ │ └── scan │ │ │ ├── PartScanInfo.java │ │ │ ├── PartScanQueue.java │ │ │ ├── ScanEdgeResult.java │ │ │ ├── ScanEdgeResultIterator.java │ │ │ ├── ScanResultIterator.java │ │ │ ├── ScanVertexResult.java │ │ │ └── ScanVertexResultIterator.java │ │ ├── encoder │ │ ├── NebulaCodec.java │ │ ├── NebulaCodecImpl.java │ │ ├── RowWriter.java │ │ ├── RowWriterImpl.java │ │ ├── SchemaProvider.java │ │ └── SchemaProviderImpl.java │ │ └── util │ │ ├── NetUtil.java │ │ ├── ReflectUtil.java │ │ └── SslUtil.java │ └── test │ ├── java │ └── com │ │ └── vesoft │ │ └── nebula │ │ ├── client │ │ ├── graph │ │ │ ├── data │ │ │ │ ├── TestData.java │ │ │ │ └── TestDataFromServer.java │ │ │ └── net │ │ │ │ ├── TestConnectionPool.java │ │ │ │ ├── TestGraphServiceClient.java │ │ │ │ ├── TestSession.java │ │ │ │ ├── TestSessionPool.java │ │ │ │ ├── TestSessionsManager.java │ │ │ │ └── TestSyncConnection.java │ │ ├── meta │ │ │ ├── MockNebulaGraph.java │ │ │ ├── TestMetaClient.java │ │ │ └── TestMetaManager.java │ │ ├── storage │ │ │ ├── MockStorageData.java │ │ │ ├── MockUtil.java │ │ │ ├── StorageClientTest.java │ │ │ ├── StorageConnPoolTest.java │ │ │ ├── processor │ │ │ │ ├── EdgeProcessorTest.java │ │ │ │ └── VertexProcessorTest.java │ │ │ └── scan │ │ │ │ └── PartScanQueueTest.java │ │ └── util │ │ │ └── ProcessUtil.java │ │ └── encoder │ │ ├── MetaCacheImplTest.java │ │ └── TestEncoder.java │ └── resources │ ├── docker-compose-casigned.yaml │ ├── docker-compose-selfsigned.yaml │ ├── docker-compose.yaml │ ├── log4j.properties │ └── ssl │ ├── client.crt │ ├── client.key │ ├── root.crt │ ├── server.crt │ ├── server.key │ └── server.password ├── codecov.yml ├── doxygen-config ├── examples ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── vesoft │ │ └── nebula │ │ └── examples │ │ ├── GraphClientExample.java │ │ ├── GraphSSLExample.java │ │ ├── GraphSessionPoolExample.java │ │ ├── GraphSessionPoolWithHttp2Example.java │ │ └── StorageClientExample.java │ └── resources │ ├── log4j.properties │ └── ssl │ ├── casigned.crt │ ├── casigned.key │ ├── casigned.pem │ ├── root.crt │ ├── selfsigned.key │ ├── selfsigned.password │ ├── selfsigned.pem │ ├── server.crt │ └── server.key ├── mvnw ├── mvnw.cmd ├── nebula_java_style_checks.xml └── pom.xml /.github/workflows/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | #### Expected behavior 2 | 3 | #### Actual behavior 4 | 5 | #### Steps to reproduce 6 | 7 | #### JVM version (e.g. `java -version`) 8 | 9 | #### Scala version (e.g. `scala -version`) 10 | 11 | #### OS version (e.g. `uname -a`) 12 | -------------------------------------------------------------------------------- /.github/workflows/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Motivation: 2 | 3 | Why you're making that change and what is the problem you're trying to solve. 4 | 5 | Modification: 6 | 7 | Describe the modifications you've done. 8 | 9 | Result: 10 | 11 | Fixes #. 12 | -------------------------------------------------------------------------------- /.github/workflows/check_label.yml: -------------------------------------------------------------------------------- 1 | name: Auto label 2 | 3 | on: 4 | issues: 5 | types: 6 | - reopened 7 | - opened 8 | - labeled 9 | - unlabeled 10 | - closed 11 | 12 | env: 13 | GH_PAT: ${{ secrets.GITHUB_TOKEN }} 14 | EVENT: ${{ toJSON(github.event)}} 15 | EVENT_NAME: ${{ github.event_name}} 16 | 17 | jobs: 18 | sync: 19 | name: auto label 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: HarrisChu/auto_label@v1 23 | -------------------------------------------------------------------------------- /.github/workflows/doxygen.yml: -------------------------------------------------------------------------------- 1 | name: Generate API reference via Doxygen and push to GitHub Pages 2 | env: 3 | # Specify the doc version to which the API reference belongs 4 | doc_version: 3.6.0 5 | on: 6 | push: 7 | branches: 8 | # Remember to update the version number 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Checkout code 17 | uses: actions/checkout@v4 18 | with: 19 | fetch-depth: 0 # fetch all commits/branches for gitversion 20 | 21 | - name: Extract branch name 22 | run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV 23 | 24 | - name: Install Doxygen 25 | run: | 26 | sudo apt-get update 27 | sudo apt-get install -y doxygen graphviz 28 | 29 | # Generate HTML files 30 | - name: Generate Documentation 31 | run: | 32 | echo "OUTPUT_DIRECTORY=$BRANCH_NAME" >> doxygen-config 33 | doxygen doxygen-config 34 | 35 | # Deploy the generated HTML files to the gh-pages branch 36 | - name: Deploy to gh-pages 37 | uses: JamesIves/github-pages-deploy-action@v4 38 | with: 39 | folder: ${{ env.BRANCH_NAME }}/html 40 | target-folder: ${{ env.BRANCH_NAME }} 41 | 42 | # - name: show gh-pages branch 43 | # run: | 44 | # git branch 45 | # git checkout . 46 | # git checkout gh-pages 47 | 48 | # # Compresses HTML files into a tar.gz file 49 | # - name: compress api reference 50 | # run: | 51 | # tar -zcvf $BRANCH_NAME.tar.gz $BRANCH_NAME 52 | 53 | # - name: transfer api reference 54 | # uses: appleboy/scp-action@master 55 | # with: 56 | # host: 20.163.77.63 57 | # username: azureuser 58 | # password: ${{ secrets.ENSITE_PASSWORD }} 59 | # port: 404 60 | # source: $BRANCH_NAME.tar.gz 61 | # # Return error if the target doc version does not already exist 62 | # target: /var/www/ent-docs/${{ env.doc_version }}/ 63 | 64 | # - name: uncompress ap reference 65 | # uses: appleboy/ssh-action@master 66 | # with: 67 | # host: 20.163.77.63 68 | # username: azureuser 69 | # password: ${{ secrets.ENSITE_PASSWORD }} 70 | # port: 404 71 | # script: | 72 | # mkdir -p /var/www/ent-docs/${{ env.doc_version}}/api/java/ 73 | # tar -zxf /var/www/ent-docs/${{ env.doc_version}}/$BRANCH_NAME.tar.gz -C /var/www/ent-docs/${{ env.doc_version}}/api/java/ 74 | 75 | -------------------------------------------------------------------------------- /.github/workflows/pull_request.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: pull_request 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: 11 | - master 12 | - 'v[0-9]+.*' 13 | 14 | jobs: 15 | build: 16 | 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v3 21 | - name: Set up JDK 1.8 22 | uses: actions/setup-java@v3 23 | with: 24 | java-version: '8' 25 | distribution: 'adopt' 26 | 27 | - name: Cache the Maven packages to speed up build 28 | uses: actions/cache@v3 29 | with: 30 | path: ~/.m2/repository 31 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 32 | restore-keys: ${{ runner.os }}-maven- 33 | 34 | - name: Install nebula-graph 35 | run: | 36 | mkdir tmp 37 | pushd tmp 38 | git clone https://github.com/vesoft-inc/nebula-docker-compose.git 39 | pushd nebula-docker-compose/ 40 | cp ../../client/src/test/resources/docker-compose.yaml . 41 | docker compose up -d 42 | sleep 30 43 | docker compose ps 44 | popd 45 | popd 46 | 47 | - name: Install nebula-graph with CA SSL 48 | run: | 49 | pushd tmp 50 | mkdir ca 51 | pushd ca 52 | cp -r ../../client/src/test/resources/ssl . 53 | cp ../../client/src/test/resources/docker-compose-casigned.yaml . 54 | docker compose -f docker-compose-casigned.yaml up -d 55 | sleep 30 56 | docker compose -f docker-compose-casigned.yaml ps 57 | popd 58 | popd 59 | 60 | - name: Install nebula-graph with Self SSL 61 | run: | 62 | pushd tmp 63 | mkdir self 64 | pushd self 65 | cp -r ../../client/src/test/resources/ssl . 66 | cp ../../client/src/test/resources/docker-compose-selfsigned.yaml . 67 | docker compose -f docker-compose-selfsigned.yaml up -d 68 | sleep 30 69 | docker compose -f docker-compose-selfsigned.yaml ps 70 | popd 71 | popd 72 | 73 | - name: Build with Maven 74 | run: | 75 | mvn -B package 76 | - uses: codecov/codecov-action@v2 77 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | release: 5 | types: 6 | - published 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check out Git repository 13 | uses: actions/checkout@v3 14 | 15 | - name: Install Java and Maven 16 | uses: actions/setup-java@v3 17 | with: 18 | java-version: '8' 19 | distribution: 'adopt' 20 | 21 | - name: Install nebula-graph 22 | run: | 23 | mkdir tmp 24 | pushd tmp 25 | git clone https://github.com/vesoft-inc/nebula-docker-compose.git 26 | pushd nebula-docker-compose/ 27 | cp ../../client/src/test/resources/docker-compose.yaml . 28 | docker compose up -d 29 | sleep 30 30 | docker compose ps 31 | popd 32 | popd 33 | 34 | - name: Install nebula-graph with CA SSL 35 | run: | 36 | pushd tmp 37 | mkdir ca 38 | pushd ca 39 | cp -r ../../client/src/test/resources/ssl . 40 | cp ../../client/src/test/resources/docker-compose-casigned.yaml . 41 | docker compose -f docker-compose-casigned.yaml up -d 42 | sleep 30 43 | docker compose -f docker-compose-casigned.yaml ps 44 | popd 45 | popd 46 | 47 | - name: Install nebula-graph with Self SSL 48 | run: | 49 | pushd tmp 50 | mkdir self 51 | pushd self 52 | cp -r ../../client/src/test/resources/ssl . 53 | cp ../../client/src/test/resources/docker-compose-selfsigned.yaml . 54 | docker compose -f docker-compose-selfsigned.yaml up -d 55 | sleep 30 56 | docker compose -f docker-compose-selfsigned.yaml ps 57 | popd 58 | popd 59 | 60 | - name: Deploy Release to Maven package 61 | uses: samuelmeuli/action-maven-publish@v1 62 | with: 63 | gpg_private_key: ${{ secrets.JAVA_GPG_PRIVATE_KEY }} 64 | gpg_passphrase: "" 65 | nexus_username: ${{ secrets.OSSRH_USERNAME }} 66 | nexus_password: ${{ secrets.OSSRH_TOKEN }} 67 | -------------------------------------------------------------------------------- /.github/workflows/snapshot.yaml: -------------------------------------------------------------------------------- 1 | name: snapshot 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | schedule: 7 | - cron: '0 6 * * *' 8 | 9 | jobs: 10 | deploy: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Check out Git repository 14 | uses: actions/checkout@v3 15 | 16 | - name: Install Java and Maven 17 | uses: actions/setup-java@v3 18 | with: 19 | java-version: '8' 20 | distribution: 'adopt' 21 | 22 | - name: Install nebula-graph 23 | run: | 24 | mkdir tmp 25 | pushd tmp 26 | git clone https://github.com/vesoft-inc/nebula-docker-compose.git 27 | pushd nebula-docker-compose/ 28 | cp ../../client/src/test/resources/docker-compose.yaml . 29 | docker compose up -d 30 | sleep 30 31 | docker compose ps 32 | popd 33 | popd 34 | 35 | - name: Install nebula-graph with CA SSL 36 | run: | 37 | pushd tmp 38 | mkdir ca 39 | pushd ca 40 | cp -r ../../client/src/test/resources/ssl . 41 | cp ../../client/src/test/resources/docker-compose-casigned.yaml . 42 | docker compose -f docker-compose-casigned.yaml up -d 43 | sleep 30 44 | docker compose -f docker-compose-casigned.yaml ps 45 | popd 46 | popd 47 | 48 | - name: Install nebula-graph with Self SSL 49 | run: | 50 | pushd tmp 51 | mkdir self 52 | pushd self 53 | cp -r ../../client/src/test/resources/ssl . 54 | cp ../../client/src/test/resources/docker-compose-selfsigned.yaml . 55 | docker compose -f docker-compose-selfsigned.yaml up -d 56 | sleep 30 57 | docker compose -f docker-compose-selfsigned.yaml ps 58 | popd 59 | popd 60 | 61 | - name: Deploy Snapshot to Maven package 62 | uses: samuelmeuli/action-maven-publish@v1 63 | with: 64 | gpg_private_key: ${{ secrets.JAVA_GPG_PRIVATE_KEY }} 65 | gpg_passphrase: "" 66 | nexus_username: ${{ secrets.OSSRH_USERNAME }} 67 | nexus_password: ${{ secrets.OSSRH_TOKEN }} 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | # build target 26 | target/ 27 | 28 | # IDE 29 | .idea/ 30 | .eclipse/ 31 | *.iml 32 | .vscode/ 33 | eclipse-formatter.xml 34 | .settings 35 | .project 36 | client/.classpath 37 | 38 | spark-importer.ipr 39 | spark-importer.iws 40 | 41 | .DS_Store 42 | 43 | examples/ 44 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 vesoft inc. All rights reserved. 2 | # 3 | # This source code is licensed under Apache 2.0 License. 4 | 5 | language: java 6 | 7 | jdk: 8 | - oraclejdk11 9 | - openjdk8 10 | - openjdk11 11 | 12 | install: mvn clean compile package install -Dgpg.skip -Dmaven.javadoc.skip=true 13 | -------------------------------------------------------------------------------- /checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/ShortStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | /** 20 | * ShortStack is a short-specific Stack implementation written for the express purpose of very fast 21 | * operations on TCompactProtocol's field id stack. This implementation performs at least 10x faster 22 | * than java.util.Stack. 23 | */ 24 | public class ShortStack { 25 | 26 | private short[] vector; 27 | private int top = -1; 28 | 29 | public ShortStack(int initialCapacity) { 30 | vector = new short[initialCapacity]; 31 | } 32 | 33 | public short pop() { 34 | return vector[top--]; 35 | } 36 | 37 | public void push(short pushed) { 38 | if (vector.length == top + 1) { 39 | grow(); 40 | } 41 | vector[++top] = pushed; 42 | } 43 | 44 | private void grow() { 45 | short[] newVector = new short[vector.length * 2]; 46 | System.arraycopy(vector, 0, newVector, 0, vector.length); 47 | vector = newVector; 48 | } 49 | 50 | public short peek() { 51 | return vector[top]; 52 | } 53 | 54 | public void clear() { 55 | top = -1; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | StringBuilder sb = new StringBuilder(); 61 | sb.append(">"); 69 | } 70 | 71 | sb.append(vector[i]); 72 | 73 | if (i == top) { 74 | sb.append("<<"); 75 | } 76 | } 77 | sb.append("]>"); 78 | return sb.toString(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | import com.facebook.thrift.protocol.TProtocol; 20 | import java.io.Serializable; 21 | 22 | /** Generic base interface for generated Thrift objects. */ 23 | public interface TBase extends Serializable { 24 | 25 | /** 26 | * Reads the TObject from the given input protocol. 27 | * 28 | * @param iprot Input protocol 29 | */ 30 | public void read(TProtocol iprot) throws TException; 31 | 32 | /** 33 | * Writes the objects out to the protocol 34 | * 35 | * @param oprot Output protocol 36 | */ 37 | public void write(TProtocol oprot) throws TException; 38 | 39 | /** 40 | * Returns a copy of `this`. The type of the returned object should be the same as the type of 41 | * this; that is, x.getClass() == x.deepCopy().getClass() should be true for any 42 | * TBase. 43 | */ 44 | public TBase deepCopy(); 45 | 46 | /** 47 | * Creates an indented String representation for pretty printing 48 | * 49 | * @param indent The level of indentation desired 50 | * @param prettyPrint Set pretty printing on/off 51 | */ 52 | public String toString(int indent, boolean prettyPrint); 53 | } 54 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TByteArrayOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | import java.io.ByteArrayOutputStream; 20 | import java.nio.charset.Charset; 21 | 22 | /** Class that allows access to the underlying buf without doing deep copies on it. */ 23 | public class TByteArrayOutputStream extends ByteArrayOutputStream { 24 | public TByteArrayOutputStream(int size) { 25 | super(size); 26 | } 27 | 28 | public TByteArrayOutputStream() { 29 | super(); 30 | } 31 | 32 | public byte[] get() { 33 | return buf; 34 | } 35 | 36 | public int len() { 37 | return count; 38 | } 39 | 40 | public String toString(Charset charset) { 41 | return new String(buf, 0, count, charset); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TClientIf.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | import com.facebook.thrift.protocol.TProtocol; 20 | 21 | public interface TClientIf { 22 | public TProtocol getInputProtocol(); 23 | 24 | public TProtocol getOutputProtocol(); 25 | } 26 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | import com.facebook.thrift.protocol.TBinaryProtocol; 20 | import com.facebook.thrift.protocol.TProtocolFactory; 21 | import com.facebook.thrift.transport.TIOStreamTransport; 22 | import java.io.ByteArrayInputStream; 23 | import java.io.UnsupportedEncodingException; 24 | 25 | /** Generic utility for easily deserializing objects from a byte array or Java String. */ 26 | public class TDeserializer { 27 | private final TProtocolFactory protocolFactory_; 28 | 29 | /** Create a new TDeserializer that uses the TBinaryProtocol by default. */ 30 | public TDeserializer() { 31 | this(new TBinaryProtocol.Factory()); 32 | } 33 | 34 | /** 35 | * Create a new TDeserializer. It will use the TProtocol specified by the factory that is passed 36 | * in. 37 | * 38 | * @param protocolFactory Factory to create a protocol 39 | */ 40 | public TDeserializer(TProtocolFactory protocolFactory) { 41 | protocolFactory_ = protocolFactory; 42 | } 43 | 44 | /** 45 | * Deserialize the Thrift object from a byte array. 46 | * 47 | * @param base The object to read into 48 | * @param bytes The array to read from 49 | */ 50 | public void deserialize(TBase base, byte[] bytes) throws TException { 51 | base.read( 52 | protocolFactory_.getProtocol(new TIOStreamTransport(new ByteArrayInputStream(bytes)))); 53 | } 54 | 55 | /** 56 | * Deserialize the Thrift object from a Java string, using a specified character set for decoding. 57 | * 58 | * @param base The object to read into 59 | * @param data The string to read from 60 | * @param charset Valid JVM charset 61 | */ 62 | public void deserialize(TBase base, String data, String charset) throws TException { 63 | try { 64 | deserialize(base, data.getBytes(charset)); 65 | } catch (UnsupportedEncodingException uex) { 66 | throw new TException("JVM DOES NOT SUPPORT ENCODING: " + charset); 67 | } 68 | } 69 | 70 | /** 71 | * Deserialize the Thrift object from a Java string, using the default JVM charset encoding. 72 | * 73 | * @param base The object to read into 74 | * @param data The string to read from 75 | */ 76 | public void fromString(TBase base, String data) throws TException { 77 | deserialize(base, data.getBytes()); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | public interface TEnum { 20 | public int getValue(); 21 | } 22 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | /** Generic exception class for Thrift. */ 20 | public class TException extends RuntimeException { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | public TException() { 25 | super(); 26 | } 27 | 28 | public TException(String message) { 29 | super(message); 30 | } 31 | 32 | public TException(Throwable cause) { 33 | super(cause); 34 | } 35 | 36 | public TException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TFieldIdEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | /** Interface for all generated struct Fields objects. */ 20 | public interface TFieldIdEnum { 21 | /** Get the Thrift field id for the named field. */ 22 | public short getThriftFieldId(); 23 | 24 | /** Get the field's name, exactly as in the IDL. */ 25 | public String getFieldName(); 26 | } 27 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TFieldRequirementType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | /** Requirement type constants. */ 20 | public final class TFieldRequirementType { 21 | public static final byte REQUIRED = 1; 22 | public static final byte OPTIONAL = 2; 23 | public static final byte DEFAULT = 3; 24 | } 25 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | import com.facebook.thrift.protocol.TProtocol; 20 | import com.facebook.thrift.server.TConnectionContext; 21 | 22 | /** 23 | * A processor is a generic object which operates upon an input stream and writes to some output 24 | * stream. 25 | */ 26 | public interface TProcessor { 27 | public boolean process(TProtocol in, TProtocol out, TConnectionContext server_ctx) 28 | throws TException; 29 | 30 | public void setEventHandler(TProcessorEventHandler handler); 31 | } 32 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/TProcessorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | import com.facebook.thrift.transport.TTransport; 20 | 21 | /** The default processor factory just returns a singleton instance. */ 22 | public class TProcessorFactory { 23 | 24 | private final TProcessor processor_; 25 | 26 | public TProcessorFactory(TProcessor processor) { 27 | processor_ = processor; 28 | } 29 | 30 | public TProcessor getProcessor(TTransport trans) { 31 | return processor_; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/UserExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift; 18 | 19 | import com.facebook.thrift.protocol.TProtocol; 20 | import com.facebook.thrift.server.TConnectionContext; 21 | import com.facebook.thrift.transport.THeaderTransport; 22 | import com.facebook.thrift.transport.TTransport; 23 | 24 | public class UserExceptionHandler extends TProcessorEventHandler { 25 | public Object getContext(String fn_name, TConnectionContext connectionContext) { 26 | 27 | TProtocol protocol = connectionContext.getOutputProtocol(); 28 | TTransport transport = protocol.getTransport(); 29 | return (transport instanceof THeaderTransport) ? transport : null; 30 | } 31 | 32 | @Override 33 | public void declaredUserException( 34 | Object handler_context, String fn_name, T th) throws TException { 35 | 36 | if (handler_context != null) { 37 | THeaderTransport headerTransport = (THeaderTransport) handler_context; 38 | headerTransport.setHeader("uex", th.getClass().getSimpleName()); 39 | // On thrift-generated exceptions, getMessage doesn't include any 40 | // declared fields (and will be unset unless somebody explicitly called 41 | // `th.setMessage()`) and toString includes declared fields but not the 42 | // message. If whoever made the exception did set a message, use that. 43 | // Otherwise, fall back to toString. It would be nice to skip toString if 44 | // there are no fields, but that would be much harder. 45 | String message = th.getMessage(); 46 | if (message != null && !message.isEmpty()) { 47 | headerTransport.setHeader("uexw", message); 48 | } else { 49 | String str = // don't inline; see JDK-8056984 50 | th.toString(1, /* prettyPrint */ false); 51 | headerTransport.setHeader("uexw", str); 52 | } 53 | } 54 | } 55 | 56 | @Override 57 | public void handlerError(Object handler_context, String fn_name, Throwable th) throws TException { 58 | 59 | if (handler_context != null) { 60 | THeaderTransport headerTransport = (THeaderTransport) handler_context; 61 | headerTransport.setHeader("uex", th.getClass().getSimpleName()); 62 | headerTransport.setHeader("uexw", th.toString()); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/annotations/Sensitive.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.annotations; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** Annotation to identify a sensitive field */ 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target({ElementType.METHOD, ElementType.FIELD}) 27 | public @interface Sensitive {} 28 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/async/AsyncMethodCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.async; 18 | 19 | public interface AsyncMethodCallback { 20 | /** 21 | * This method will be called when the remote side has completed invoking your method call and the 22 | * result is fully read. For oneway method calls, this method will be called as soon as we have 23 | * completed writing out the request. 24 | */ 25 | public void onComplete(TAsyncMethodCall response); 26 | 27 | /** 28 | * This method will be called when there is an unexpected clientside exception. This does not 29 | * include application-defined exceptions that appear in the IDL, but rather things like 30 | * IOExceptions. 31 | */ 32 | public void onError(Exception exception); 33 | } 34 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/async/TAsyncClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.async; 18 | 19 | import com.facebook.thrift.transport.TNonblockingTransport; 20 | 21 | public interface TAsyncClientFactory { 22 | public T getAsyncClient(TNonblockingTransport transport); 23 | } 24 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/meta_data/FieldMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.meta_data; 18 | 19 | import com.facebook.thrift.TBase; 20 | import java.util.Map; 21 | import java.util.concurrent.ConcurrentHashMap; 22 | 23 | /** 24 | * This class is used to store meta data about thrift fields. Every field in a a struct should have 25 | * a corresponding instance of this class describing it. 26 | */ 27 | @SuppressWarnings("serial") 28 | public class FieldMetaData implements java.io.Serializable { 29 | public final String fieldName; 30 | public final byte requirementType; 31 | public final FieldValueMetaData valueMetaData; 32 | private static Map, Map> structMap; 33 | 34 | static { 35 | structMap = new ConcurrentHashMap, Map>(); 36 | } 37 | 38 | public FieldMetaData(String name, byte req, FieldValueMetaData vMetaData) { 39 | this.fieldName = name; 40 | this.requirementType = req; 41 | this.valueMetaData = vMetaData; 42 | } 43 | 44 | public static void addStructMetaDataMap( 45 | Class sClass, Map map) { 46 | structMap.put(sClass, map); 47 | } 48 | 49 | /** 50 | * Returns a map with metadata (i.e. instances of FieldMetaData) that describe the fields of the 51 | * given class. 52 | * 53 | * @param sClass The TBase class for which the metadata map is requested 54 | */ 55 | public static Map getStructMetaDataMap(Class sClass) { 56 | if (!structMap.containsKey(sClass)) { // Load class if it hasn't been loaded 57 | try { 58 | sClass.newInstance(); 59 | } catch (InstantiationException e) { 60 | throw new RuntimeException( 61 | "InstantiationException for TBase class: " 62 | + sClass.getName() 63 | + ", message: " 64 | + e.getMessage()); 65 | } catch (IllegalAccessException e) { 66 | throw new RuntimeException( 67 | "IllegalAccessException for TBase class: " 68 | + sClass.getName() 69 | + ", message: " 70 | + e.getMessage()); 71 | } 72 | } 73 | return structMap.get(sClass); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/meta_data/FieldValueMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.meta_data; 18 | 19 | import com.facebook.thrift.protocol.TType; 20 | 21 | /** 22 | * FieldValueMetaData and collection of subclasses to store metadata about the value(s) of a field 23 | */ 24 | @SuppressWarnings("serial") 25 | public class FieldValueMetaData implements java.io.Serializable { 26 | public final byte type; 27 | 28 | public FieldValueMetaData(byte type) { 29 | this.type = type; 30 | } 31 | 32 | public boolean isStruct() { 33 | return type == TType.STRUCT; 34 | } 35 | 36 | public boolean isContainer() { 37 | return type == TType.LIST || type == TType.MAP || type == TType.SET; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/meta_data/ListMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.meta_data; 18 | 19 | @SuppressWarnings("serial") 20 | public class ListMetaData extends FieldValueMetaData { 21 | public final FieldValueMetaData elemMetaData; 22 | 23 | public ListMetaData(byte type, FieldValueMetaData eMetaData) { 24 | super(type); 25 | this.elemMetaData = eMetaData; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/meta_data/MapMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.meta_data; 18 | 19 | @SuppressWarnings("serial") 20 | public class MapMetaData extends FieldValueMetaData { 21 | public final FieldValueMetaData keyMetaData; 22 | public final FieldValueMetaData valueMetaData; 23 | 24 | public MapMetaData(byte type, FieldValueMetaData kMetaData, FieldValueMetaData vMetaData) { 25 | super(type); 26 | this.keyMetaData = kMetaData; 27 | this.valueMetaData = vMetaData; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/meta_data/SetMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.meta_data; 18 | 19 | @SuppressWarnings("serial") 20 | public class SetMetaData extends FieldValueMetaData { 21 | public final FieldValueMetaData elemMetaData; 22 | 23 | public SetMetaData(byte type, FieldValueMetaData eMetaData) { 24 | super(type); 25 | this.elemMetaData = eMetaData; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/meta_data/StructMetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.meta_data; 18 | 19 | import com.facebook.thrift.TBase; 20 | 21 | @SuppressWarnings("serial") 22 | public class StructMetaData extends FieldValueMetaData { 23 | public final Class structClass; 24 | 25 | public StructMetaData(byte type, Class sClass) { 26 | super(type); 27 | this.structClass = sClass; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | /** Helper class that encapsulates field metadata. */ 23 | public class TField { 24 | private static final Map EMPTY_METADATA = new HashMap(); 25 | 26 | public TField() { 27 | this("", TType.STOP, (short) 0); 28 | } 29 | 30 | public TField(String name, byte type, short id) { 31 | this(name, type, id, EMPTY_METADATA); 32 | } 33 | 34 | public TField(String name, byte type, short id, Map metadata) { 35 | this.name = name; 36 | this.type = type; 37 | this.id = id; 38 | this.metadata = metadata; 39 | } 40 | 41 | public final String name; 42 | public final byte type; 43 | public final short id; 44 | public final Map metadata; 45 | 46 | public String toString() { 47 | return String.format( 48 | "", name, type, id, metadata); 49 | } 50 | 51 | public boolean equals(TField otherField) { 52 | return type == otherField.type && id == otherField.id; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | /** Helper class that encapsulates list metadata. */ 20 | public final class TList { 21 | public TList() { 22 | this(TType.STOP, 0); 23 | } 24 | 25 | public TList(byte t, int s) { 26 | elemType = t; 27 | size = s; 28 | } 29 | 30 | public final byte elemType; 31 | public final int size; 32 | } 33 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | /** Helper class that encapsulates map metadata. */ 20 | public final class TMap { 21 | public TMap() { 22 | this(TType.STOP, TType.STOP, 0); 23 | } 24 | 25 | public TMap(byte k, byte v, int s) { 26 | keyType = k; 27 | valueType = v; 28 | size = s; 29 | } 30 | 31 | public final byte keyType; 32 | public final byte valueType; 33 | public final int size; 34 | } 35 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | /** Helper class that encapsulates struct metadata. */ 20 | public final class TMessage { 21 | public TMessage() { 22 | this("", TType.STOP, 0); 23 | } 24 | 25 | public TMessage(String n, byte t, int s) { 26 | name = n; 27 | type = t; 28 | seqid = s; 29 | } 30 | 31 | public final String name; 32 | public final byte type; 33 | public final int seqid; 34 | 35 | @Override 36 | public String toString() { 37 | return ""; 38 | } 39 | 40 | @Override 41 | public boolean equals(Object other) { 42 | if (other instanceof TMessage) { 43 | return equals((TMessage) other); 44 | } 45 | return false; 46 | } 47 | 48 | public boolean equals(TMessage other) { 49 | return name.equals(other.name) && type == other.type && seqid == other.seqid; 50 | } 51 | 52 | // if you override hashCode or equals, you must override the other 53 | @Override 54 | public int hashCode() { 55 | return name.hashCode() * ((seqid << 8) | type); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TMessageType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | /** Message type constants in the Thrift protocol. */ 20 | public final class TMessageType { 21 | public static final byte CALL = 1; 22 | public static final byte REPLY = 2; 23 | public static final byte EXCEPTION = 3; 24 | public static final byte ONEWAY = 4; 25 | } 26 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TProtocolException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | import com.facebook.thrift.TException; 20 | 21 | /** Protocol exceptions. */ 22 | public class TProtocolException extends TException { 23 | 24 | private static final long serialVersionUID = 1L; 25 | public static final int UNKNOWN = 0; 26 | public static final int INVALID_DATA = 1; 27 | public static final int NEGATIVE_SIZE = 2; 28 | public static final int SIZE_LIMIT = 3; 29 | public static final int BAD_VERSION = 4; 30 | public static final int NOT_IMPLEMENTED = 5; 31 | public static final int MISSING_REQUIRED_FIELD = 6; 32 | 33 | protected int type_ = UNKNOWN; 34 | 35 | public TProtocolException() { 36 | super(); 37 | } 38 | 39 | public TProtocolException(int type) { 40 | super(); 41 | type_ = type; 42 | } 43 | 44 | public TProtocolException(int type, String message) { 45 | super(message); 46 | type_ = type; 47 | } 48 | 49 | public TProtocolException(String message) { 50 | super(message); 51 | } 52 | 53 | public TProtocolException(int type, Throwable cause) { 54 | super(cause); 55 | type_ = type; 56 | } 57 | 58 | public TProtocolException(Throwable cause) { 59 | super(cause); 60 | } 61 | 62 | public TProtocolException(String message, Throwable cause) { 63 | super(message, cause); 64 | } 65 | 66 | public TProtocolException(int type, String message, Throwable cause) { 67 | super(message, cause); 68 | type_ = type; 69 | } 70 | 71 | public int getType() { 72 | return type_; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TProtocolFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | import com.facebook.thrift.transport.TTransport; 20 | import java.io.Serializable; 21 | 22 | /** Factory interface for constructing protocol instances. */ 23 | public interface TProtocolFactory extends Serializable { 24 | public TProtocol getProtocol(TTransport trans); 25 | } 26 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | /** Helper class that encapsulates set metadata. */ 20 | public final class TSet { 21 | public TSet() { 22 | this(TType.STOP, 0); 23 | } 24 | 25 | public TSet(byte t, int s) { 26 | elemType = t; 27 | size = s; 28 | } 29 | 30 | public TSet(TList list) { 31 | this(list.elemType, list.size); 32 | } 33 | 34 | public final byte elemType; 35 | public final int size; 36 | } 37 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TStruct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | /** Helper class that encapsulates struct metadata. */ 20 | public final class TStruct { 21 | public TStruct() { 22 | this(""); 23 | } 24 | 25 | public TStruct(String n) { 26 | name = n; 27 | } 28 | 29 | public final String name; 30 | } 31 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/protocol/TType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.protocol; 18 | 19 | /** Type constants in the Thrift protocol. */ 20 | public final class TType { 21 | public static final byte STOP = 0; 22 | public static final byte VOID = 1; 23 | public static final byte BOOL = 2; 24 | public static final byte BYTE = 3; 25 | public static final byte DOUBLE = 4; 26 | public static final byte I16 = 6; 27 | public static final byte I32 = 8; 28 | public static final byte I64 = 10; 29 | public static final byte STRING = 11; 30 | public static final byte STRUCT = 12; 31 | public static final byte MAP = 13; 32 | public static final byte SET = 14; 33 | public static final byte LIST = 15; 34 | public static final byte ENUM = 16; 35 | public static final byte FLOAT = 19; 36 | } 37 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/scheme/IScheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.scheme; 18 | 19 | import com.facebook.thrift.TBase; 20 | import com.facebook.thrift.TException; 21 | import com.facebook.thrift.protocol.TProtocol; 22 | 23 | public interface IScheme { 24 | public void read(TProtocol iproto, T struct) throws TException; 25 | 26 | public void write(TProtocol oproto, T struct) throws TException; 27 | } 28 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/scheme/SchemeFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.scheme; 18 | 19 | public interface SchemeFactory { 20 | 21 | public S getScheme(); 22 | } 23 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/scheme/StandardScheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.scheme; 18 | 19 | import com.facebook.thrift.TBase; 20 | 21 | public abstract class StandardScheme implements IScheme {} 22 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/scheme/TupleScheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.scheme; 18 | 19 | import com.facebook.thrift.TBase; 20 | 21 | public abstract class TupleScheme implements IScheme {} 22 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/server/TConnectionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.server; 18 | 19 | import com.facebook.thrift.protocol.TProtocol; 20 | import java.net.InetAddress; 21 | 22 | /** Generic Thrift server connection context */ 23 | public class TConnectionContext { 24 | protected TProtocol input_protocol; 25 | protected TProtocol output_protocol; 26 | 27 | public TConnectionContext(TProtocol input_protocol, TProtocol output_protocol) { 28 | this.input_protocol = input_protocol; 29 | this.output_protocol = output_protocol; 30 | } 31 | 32 | public TProtocol getInputProtocol() { 33 | return input_protocol; 34 | } 35 | 36 | public TProtocol getOutputProtocol() { 37 | return output_protocol; 38 | } 39 | 40 | public InetAddress getPeerAddress() { 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/server/TRpcConnectionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.server; 18 | 19 | import com.facebook.thrift.protocol.TProtocol; 20 | import com.facebook.thrift.transport.TSocketIf; 21 | import com.facebook.thrift.transport.TTransport; 22 | import java.net.InetAddress; 23 | 24 | /** Generic interface for a Thrift server. */ 25 | public class TRpcConnectionContext extends TConnectionContext { 26 | protected TTransport client_socket; 27 | 28 | public TRpcConnectionContext( 29 | TTransport client_socket, TProtocol input_protocol, TProtocol output_protocol) { 30 | super(input_protocol, output_protocol); 31 | this.client_socket = client_socket; 32 | } 33 | 34 | @Override 35 | public InetAddress getPeerAddress() { 36 | TSocketIf socket = (TSocketIf) client_socket; 37 | return socket.getSocket().getInetAddress(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/server/TThreadFactoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.server; 18 | 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | import java.util.concurrent.ThreadFactory; 22 | import java.util.concurrent.atomic.AtomicInteger; 23 | 24 | /** 25 | * This class is an implementation of the ThreadFactory interface. This is useful to give 26 | * Java threads meaningful names which is useful when using a tool like JConsole. 27 | */ 28 | public class TThreadFactoryImpl implements ThreadFactory { 29 | protected String id_; 30 | protected Long version_; 31 | protected ThreadGroup threadGroup_; 32 | protected final AtomicInteger threadNbr_ = new AtomicInteger(1); 33 | protected static final Map poolVersionByName = new HashMap(); 34 | 35 | public TThreadFactoryImpl(String id) { 36 | SecurityManager sm = System.getSecurityManager(); 37 | threadGroup_ = (sm != null) ? sm.getThreadGroup() : Thread.currentThread().getThreadGroup(); 38 | Long lastVersion; 39 | synchronized (this) { 40 | if ((lastVersion = poolVersionByName.get(id)) == null) { 41 | lastVersion = Long.valueOf(-1); 42 | } 43 | poolVersionByName.put(id, lastVersion + 1); 44 | } 45 | version_ = lastVersion != null ? lastVersion + 1 : 0; 46 | id_ = id; 47 | } 48 | 49 | public Thread newThread(Runnable runnable) { 50 | String name = id_ + "-" + version_ + "-thread-" + threadNbr_.getAndIncrement(); 51 | Thread thread = new Thread(threadGroup_, runnable, name); 52 | return thread; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/OkHttp3Util.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2023 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.facebook.thrift.transport; 7 | 8 | import java.util.Arrays; 9 | import java.util.concurrent.TimeUnit; 10 | import javax.net.ssl.SSLSocketFactory; 11 | import javax.net.ssl.TrustManager; 12 | import javax.net.ssl.X509TrustManager; 13 | import okhttp3.OkHttpClient; 14 | import okhttp3.Protocol; 15 | 16 | public class OkHttp3Util { 17 | private static OkHttpClient client; 18 | 19 | private OkHttp3Util() { 20 | } 21 | 22 | public static OkHttpClient getClient(int connectTimeout, int readTimeout, 23 | SSLSocketFactory sslFactory, 24 | TrustManager trustManager) { 25 | if (client == null) { 26 | synchronized (OkHttp3Util.class) { 27 | if (client == null) { 28 | // Create OkHttpClient builder 29 | OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() 30 | .connectTimeout(connectTimeout, TimeUnit.MILLISECONDS) 31 | .writeTimeout(readTimeout, TimeUnit.MILLISECONDS) 32 | .readTimeout(readTimeout, TimeUnit.MILLISECONDS); 33 | if (sslFactory != null) { 34 | clientBuilder.sslSocketFactory(sslFactory, (X509TrustManager) trustManager); 35 | clientBuilder.protocols(Arrays.asList(Protocol.HTTP_2, Protocol.HTTP_1_1)); 36 | } else { 37 | // config the http2 prior knowledge 38 | clientBuilder.protocols(Arrays.asList(Protocol.H2_PRIOR_KNOWLEDGE)); 39 | } 40 | client = clientBuilder.build(); 41 | } 42 | } 43 | } 44 | return client; 45 | } 46 | 47 | public static void close(){ 48 | if (client != null) { 49 | client.connectionPool().evictAll(); 50 | client.dispatcher().executorService().shutdown(); 51 | client = null; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/THeaderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | /** Application level exception */ 20 | public class THeaderException extends TTransportException { 21 | private static final long serialVersionUID = 1L; 22 | 23 | public THeaderException(String message) { 24 | super(message); 25 | } 26 | 27 | public THeaderException(Throwable throwable) { 28 | super(throwable); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/TMemoryInputTransport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | public final class TMemoryInputTransport extends TTransport { 20 | 21 | private byte[] buf_; 22 | private int pos_; 23 | private int endPos_; 24 | 25 | public TMemoryInputTransport() {} 26 | 27 | public TMemoryInputTransport(byte[] buf) { 28 | reset(buf); 29 | } 30 | 31 | public TMemoryInputTransport(byte[] buf, int offset, int length) { 32 | reset(buf, offset, length); 33 | } 34 | 35 | public void reset(byte[] buf) { 36 | reset(buf, 0, buf.length); 37 | } 38 | 39 | public void reset(byte[] buf, int offset, int length) { 40 | buf_ = buf; 41 | pos_ = offset; 42 | endPos_ = offset + length; 43 | } 44 | 45 | @Override 46 | public void close() {} 47 | 48 | @Override 49 | public boolean isOpen() { 50 | return true; 51 | } 52 | 53 | @Override 54 | public void open() throws TTransportException {} 55 | 56 | @Override 57 | public int read(byte[] buf, int off, int len) throws TTransportException { 58 | int bytesRemaining = getBytesRemainingInBuffer(); 59 | int amtToRead = (len > bytesRemaining ? bytesRemaining : len); 60 | if (amtToRead > 0) { 61 | System.arraycopy(buf_, pos_, buf, off, amtToRead); 62 | consumeBuffer(amtToRead); 63 | } 64 | return amtToRead; 65 | } 66 | 67 | @Override 68 | public void write(byte[] buf, int off, int len) throws TTransportException { 69 | throw new UnsupportedOperationException("No writing allowed!"); 70 | } 71 | 72 | @Override 73 | public byte[] getBuffer() { 74 | return buf_; 75 | } 76 | 77 | public int getBufferPosition() { 78 | return pos_; 79 | } 80 | 81 | public int getBytesRemainingInBuffer() { 82 | return endPos_ - pos_; 83 | } 84 | 85 | public void consumeBuffer(int len) { 86 | pos_ += len; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/TNonblockingServerTransport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | import java.nio.channels.Selector; 20 | 21 | /** Server transport that can be operated in a nonblocking fashion. */ 22 | public abstract class TNonblockingServerTransport extends TServerTransport { 23 | 24 | public abstract void registerSelector(Selector selector); 25 | } 26 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/TNonblockingTransport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | import java.io.IOException; 20 | import java.nio.ByteBuffer; 21 | import java.nio.channels.SelectionKey; 22 | import java.nio.channels.Selector; 23 | 24 | public abstract class TNonblockingTransport extends TTransport { 25 | /** 26 | * Non-blocking connection initialization. 27 | * 28 | * @see java.nio.channels.SocketChannel#connect(SocketAddress remote) 29 | */ 30 | public abstract boolean startConnect() throws IOException; 31 | 32 | /** 33 | * Non-blocking connection completion. 34 | * 35 | * @see java.nio.channels.SocketChannel#finishConnect() 36 | */ 37 | public abstract boolean finishConnect() throws IOException; 38 | 39 | public abstract SelectionKey registerSelector(Selector selector, int interests) 40 | throws IOException; 41 | 42 | public abstract int read(ByteBuffer buffer) throws IOException; 43 | 44 | public abstract int write(ByteBuffer buffer) throws IOException; 45 | } 46 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/TServerTransport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | /** Server transport. Object which provides client transports. */ 20 | public abstract class TServerTransport { 21 | 22 | public abstract void listen() throws TTransportException; 23 | 24 | public final TTransport accept() throws TTransportException { 25 | TTransport transport = acceptImpl(); 26 | if (transport == null) { 27 | throw new TTransportException("accept() may not return NULL"); 28 | } 29 | return transport; 30 | } 31 | 32 | public abstract void close(); 33 | 34 | protected abstract TTransport acceptImpl() throws TTransportException; 35 | 36 | /** 37 | * Optional method implementation. This signals to the server transport that it should break out 38 | * of any accept() or listen() that it is currently blocked on. This method, if implemented, MUST 39 | * be thread safe, as it may be called from a different thread context than the other 40 | * TServerTransport methods. 41 | */ 42 | public void interrupt() {} 43 | } 44 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/TSocketIf.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | import java.net.Socket; 20 | 21 | public interface TSocketIf { 22 | public Socket getSocket(); 23 | } 24 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/TTransportException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | import com.facebook.thrift.TException; 20 | 21 | /** Transport exceptions. */ 22 | public class TTransportException extends TException { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | public static final int UNKNOWN = 0; 27 | public static final int NOT_OPEN = 1; 28 | public static final int ALREADY_OPEN = 2; 29 | public static final int TIMED_OUT = 3; 30 | public static final int END_OF_FILE = 4; 31 | 32 | protected int type_ = UNKNOWN; 33 | 34 | public TTransportException() { 35 | super(); 36 | } 37 | 38 | public TTransportException(int type) { 39 | super(); 40 | type_ = type; 41 | } 42 | 43 | public TTransportException(int type, String message) { 44 | super(message); 45 | type_ = type; 46 | } 47 | 48 | public TTransportException(String message) { 49 | super(message); 50 | } 51 | 52 | public TTransportException(int type, Throwable cause) { 53 | super(cause); 54 | type_ = type; 55 | } 56 | 57 | public TTransportException(Throwable cause) { 58 | super(cause); 59 | } 60 | 61 | public TTransportException(String message, Throwable cause) { 62 | super(message, cause); 63 | } 64 | 65 | public TTransportException(int type, String message, Throwable cause) { 66 | super(message, cause); 67 | type_ = type; 68 | } 69 | 70 | public int getType() { 71 | return type_; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/transport/TTransportFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.transport; 18 | 19 | /** 20 | * Factory class used to create wrapped instance of Transports. This is used primarily in servers, 21 | * which get Transports from a ServerTransport and then may want to mutate them (i.e. create a 22 | * BufferedTransport from the underlying base transport) 23 | */ 24 | public class TTransportFactory { 25 | 26 | /** 27 | * Return a wrapped instance of the base Transport. 28 | * 29 | * @param trans The base transport 30 | * @return Wrapped Transport 31 | */ 32 | public TTransport getTransport(TTransport trans) { 33 | return trans; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /client/src/main/fbthrift/com/facebook/thrift/utils/StandardCharsets.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.facebook.thrift.utils; 18 | 19 | import java.nio.charset.Charset; 20 | 21 | public class StandardCharsets { 22 | // For android compatibility with API < 19 23 | public static Charset UTF_8 = Charset.forName("UTF-8"); 24 | } 25 | -------------------------------------------------------------------------------- /client/src/main/generated/Role.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | 8 | import com.facebook.thrift.IntRangeSet; 9 | import java.util.Map; 10 | import java.util.HashMap; 11 | 12 | @SuppressWarnings({ "unused" }) 13 | public enum Role implements com.facebook.thrift.TEnum { 14 | LEADER(1), 15 | FOLLOWER(2), 16 | CANDIDATE(3), 17 | LEARNER(4); 18 | 19 | private final int value; 20 | 21 | private Role(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static Role findByValue(int value) { 37 | switch (value) { 38 | case 1: 39 | return LEADER; 40 | case 2: 41 | return FOLLOWER; 42 | case 3: 43 | return CANDIDATE; 44 | case 4: 45 | return LEARNER; 46 | default: 47 | return null; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /client/src/main/generated/Status.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | 8 | import com.facebook.thrift.IntRangeSet; 9 | import java.util.Map; 10 | import java.util.HashMap; 11 | 12 | @SuppressWarnings({ "unused" }) 13 | public enum Status implements com.facebook.thrift.TEnum { 14 | STARTING(0), 15 | RUNNING(1), 16 | STOPPED(2), 17 | WAITING_SNAPSHOT(3), 18 | WAITING_CHECKPOINT(4); 19 | 20 | private final int value; 21 | 22 | private Status(int value) { 23 | this.value = value; 24 | } 25 | 26 | /** 27 | * Get the integer value of this enum value, as defined in the Thrift IDL. 28 | */ 29 | public int getValue() { 30 | return value; 31 | } 32 | 33 | /** 34 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 35 | * @return null if the value is not found. 36 | */ 37 | public static Status findByValue(int value) { 38 | switch (value) { 39 | case 0: 40 | return STARTING; 41 | case 1: 42 | return RUNNING; 43 | case 2: 44 | return STOPPED; 45 | case 3: 46 | return WAITING_SNAPSHOT; 47 | case 4: 48 | return WAITING_CHECKPOINT; 49 | default: 50 | return null; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/Constants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula; 8 | 9 | import java.util.List; 10 | import java.util.ArrayList; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | import java.util.Set; 14 | import java.util.HashSet; 15 | import java.util.Collections; 16 | import java.util.BitSet; 17 | import java.util.Arrays; 18 | @SuppressWarnings({ "unused" }) 19 | public class Constants { 20 | 21 | public static final byte[] version = "3.0.0".getBytes(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/NullType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum NullType implements com.facebook.thrift.TEnum { 16 | __NULL__(0), 17 | NaN(1), 18 | BAD_DATA(2), 19 | BAD_TYPE(3), 20 | ERR_OVERFLOW(4), 21 | UNKNOWN_PROP(5), 22 | DIV_BY_ZERO(6), 23 | OUT_OF_RANGE(7); 24 | 25 | private final int value; 26 | 27 | private NullType(int value) { 28 | this.value = value; 29 | } 30 | 31 | /** 32 | * Get the integer value of this enum value, as defined in the Thrift IDL. 33 | */ 34 | public int getValue() { 35 | return value; 36 | } 37 | 38 | /** 39 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 40 | * @return null if the value is not found. 41 | */ 42 | public static NullType findByValue(int value) { 43 | switch (value) { 44 | case 0: 45 | return __NULL__; 46 | case 1: 47 | return NaN; 48 | case 2: 49 | return BAD_DATA; 50 | case 3: 51 | return BAD_TYPE; 52 | case 4: 53 | return ERR_OVERFLOW; 54 | case 5: 55 | return UNKNOWN_PROP; 56 | case 6: 57 | return DIV_BY_ZERO; 58 | case 7: 59 | return OUT_OF_RANGE; 60 | default: 61 | return null; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/PropertyType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum PropertyType implements com.facebook.thrift.TEnum { 16 | UNKNOWN(0), 17 | BOOL(1), 18 | INT64(2), 19 | VID(3), 20 | FLOAT(4), 21 | DOUBLE(5), 22 | STRING(6), 23 | FIXED_STRING(7), 24 | INT8(8), 25 | INT16(9), 26 | INT32(10), 27 | TIMESTAMP(21), 28 | DURATION(23), 29 | DATE(24), 30 | DATETIME(25), 31 | TIME(26), 32 | GEOGRAPHY(31); 33 | 34 | private static final Map INDEXED_VALUES = new HashMap(); 35 | 36 | static { 37 | for (PropertyType e: values()) { 38 | INDEXED_VALUES.put(e.getValue(), e); 39 | } 40 | } 41 | 42 | private final int value; 43 | 44 | private PropertyType(int value) { 45 | this.value = value; 46 | } 47 | 48 | /** 49 | * Get the integer value of this enum value, as defined in the Thrift IDL. 50 | */ 51 | public int getValue() { 52 | return value; 53 | } 54 | 55 | /** 56 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 57 | * @return null if the value is not found. 58 | */ 59 | public static PropertyType findByValue(int value) { 60 | return INDEXED_VALUES.get(value); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/SyncStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum SyncStatus implements com.facebook.thrift.TEnum { 16 | UNKNOWN(0), 17 | ONLINE(1), 18 | OFFLINE(2); 19 | 20 | private final int value; 21 | 22 | private SyncStatus(int value) { 23 | this.value = value; 24 | } 25 | 26 | /** 27 | * Get the integer value of this enum value, as defined in the Thrift IDL. 28 | */ 29 | public int getValue() { 30 | return value; 31 | } 32 | 33 | /** 34 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 35 | * @return null if the value is not found. 36 | */ 37 | public static SyncStatus findByValue(int value) { 38 | switch (value) { 39 | case 0: 40 | return UNKNOWN; 41 | case 1: 42 | return ONLINE; 43 | case 2: 44 | return OFFLINE; 45 | default: 46 | return null; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/AlterSchemaOp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum AlterSchemaOp implements com.facebook.thrift.TEnum { 16 | ADD(1), 17 | CHANGE(2), 18 | DROP(3), 19 | UNKNOWN(4); 20 | 21 | private final int value; 22 | 23 | private AlterSchemaOp(int value) { 24 | this.value = value; 25 | } 26 | 27 | /** 28 | * Get the integer value of this enum value, as defined in the Thrift IDL. 29 | */ 30 | public int getValue() { 31 | return value; 32 | } 33 | 34 | /** 35 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 36 | * @return null if the value is not found. 37 | */ 38 | public static AlterSchemaOp findByValue(int value) { 39 | switch (value) { 40 | case 1: 41 | return ADD; 42 | case 2: 43 | return CHANGE; 44 | case 3: 45 | return DROP; 46 | case 4: 47 | return UNKNOWN; 48 | default: 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/AlterSpaceOp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum AlterSpaceOp implements com.facebook.thrift.TEnum { 16 | ADD_ZONE(1); 17 | 18 | private final int value; 19 | 20 | private AlterSpaceOp(int value) { 21 | this.value = value; 22 | } 23 | 24 | /** 25 | * Get the integer value of this enum value, as defined in the Thrift IDL. 26 | */ 27 | public int getValue() { 28 | return value; 29 | } 30 | 31 | /** 32 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 33 | * @return null if the value is not found. 34 | */ 35 | public static AlterSpaceOp findByValue(int value) { 36 | switch (value) { 37 | case 1: 38 | return ADD_ZONE; 39 | default: 40 | return null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/ConfigMode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum ConfigMode implements com.facebook.thrift.TEnum { 16 | IMMUTABLE(0), 17 | REBOOT(1), 18 | MUTABLE(2), 19 | IGNORED(3); 20 | 21 | private final int value; 22 | 23 | private ConfigMode(int value) { 24 | this.value = value; 25 | } 26 | 27 | /** 28 | * Get the integer value of this enum value, as defined in the Thrift IDL. 29 | */ 30 | public int getValue() { 31 | return value; 32 | } 33 | 34 | /** 35 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 36 | * @return null if the value is not found. 37 | */ 38 | public static ConfigMode findByValue(int value) { 39 | switch (value) { 40 | case 0: 41 | return IMMUTABLE; 42 | case 1: 43 | return REBOOT; 44 | case 2: 45 | return MUTABLE; 46 | case 3: 47 | return IGNORED; 48 | default: 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/ConfigModule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum ConfigModule implements com.facebook.thrift.TEnum { 16 | UNKNOWN(0), 17 | ALL(1), 18 | GRAPH(2), 19 | META(3), 20 | STORAGE(4); 21 | 22 | private final int value; 23 | 24 | private ConfigModule(int value) { 25 | this.value = value; 26 | } 27 | 28 | /** 29 | * Get the integer value of this enum value, as defined in the Thrift IDL. 30 | */ 31 | public int getValue() { 32 | return value; 33 | } 34 | 35 | /** 36 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 37 | * @return null if the value is not found. 38 | */ 39 | public static ConfigModule findByValue(int value) { 40 | switch (value) { 41 | case 0: 42 | return UNKNOWN; 43 | case 1: 44 | return ALL; 45 | case 2: 46 | return GRAPH; 47 | case 3: 48 | return META; 49 | case 4: 50 | return STORAGE; 51 | default: 52 | return null; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/ExternalServiceType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum ExternalServiceType implements com.facebook.thrift.TEnum { 16 | ELASTICSEARCH(1); 17 | 18 | private final int value; 19 | 20 | private ExternalServiceType(int value) { 21 | this.value = value; 22 | } 23 | 24 | /** 25 | * Get the integer value of this enum value, as defined in the Thrift IDL. 26 | */ 27 | public int getValue() { 28 | return value; 29 | } 30 | 31 | /** 32 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 33 | * @return null if the value is not found. 34 | */ 35 | public static ExternalServiceType findByValue(int value) { 36 | switch (value) { 37 | case 1: 38 | return ELASTICSEARCH; 39 | default: 40 | return null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/ExternalSpaceServiceType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum ExternalSpaceServiceType implements com.facebook.thrift.TEnum { 16 | DRAINER(1); 17 | 18 | private final int value; 19 | 20 | private ExternalSpaceServiceType(int value) { 21 | this.value = value; 22 | } 23 | 24 | /** 25 | * Get the integer value of this enum value, as defined in the Thrift IDL. 26 | */ 27 | public int getValue() { 28 | return value; 29 | } 30 | 31 | /** 32 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 33 | * @return null if the value is not found. 34 | */ 35 | public static ExternalSpaceServiceType findByValue(int value) { 36 | switch (value) { 37 | case 1: 38 | return DRAINER; 39 | default: 40 | return null; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/GeoShape.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum GeoShape implements com.facebook.thrift.TEnum { 16 | ANY(0), 17 | POINT(1), 18 | LINESTRING(2), 19 | POLYGON(3); 20 | 21 | private final int value; 22 | 23 | private GeoShape(int value) { 24 | this.value = value; 25 | } 26 | 27 | /** 28 | * Get the integer value of this enum value, as defined in the Thrift IDL. 29 | */ 30 | public int getValue() { 31 | return value; 32 | } 33 | 34 | /** 35 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 36 | * @return null if the value is not found. 37 | */ 38 | public static GeoShape findByValue(int value) { 39 | switch (value) { 40 | case 0: 41 | return ANY; 42 | case 1: 43 | return POINT; 44 | case 2: 45 | return LINESTRING; 46 | case 3: 47 | return POLYGON; 48 | default: 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/HostRole.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum HostRole implements com.facebook.thrift.TEnum { 16 | GRAPH(0), 17 | META(1), 18 | STORAGE(2), 19 | STORAGE_LISTENER(3), 20 | AGENT(4), 21 | UNKNOWN(5), 22 | DRAINER(6), 23 | META_LISTENER(7); 24 | 25 | private final int value; 26 | 27 | private HostRole(int value) { 28 | this.value = value; 29 | } 30 | 31 | /** 32 | * Get the integer value of this enum value, as defined in the Thrift IDL. 33 | */ 34 | public int getValue() { 35 | return value; 36 | } 37 | 38 | /** 39 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 40 | * @return null if the value is not found. 41 | */ 42 | public static HostRole findByValue(int value) { 43 | switch (value) { 44 | case 0: 45 | return GRAPH; 46 | case 1: 47 | return META; 48 | case 2: 49 | return STORAGE; 50 | case 3: 51 | return STORAGE_LISTENER; 52 | case 4: 53 | return AGENT; 54 | case 5: 55 | return UNKNOWN; 56 | case 6: 57 | return DRAINER; 58 | case 7: 59 | return META_LISTENER; 60 | default: 61 | return null; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/HostStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum HostStatus implements com.facebook.thrift.TEnum { 16 | ONLINE(0), 17 | OFFLINE(1), 18 | UNKNOWN(2); 19 | 20 | private final int value; 21 | 22 | private HostStatus(int value) { 23 | this.value = value; 24 | } 25 | 26 | /** 27 | * Get the integer value of this enum value, as defined in the Thrift IDL. 28 | */ 29 | public int getValue() { 30 | return value; 31 | } 32 | 33 | /** 34 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 35 | * @return null if the value is not found. 36 | */ 37 | public static HostStatus findByValue(int value) { 38 | switch (value) { 39 | case 0: 40 | return ONLINE; 41 | case 1: 42 | return OFFLINE; 43 | case 2: 44 | return UNKNOWN; 45 | default: 46 | return null; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/IsolationLevel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum IsolationLevel implements com.facebook.thrift.TEnum { 16 | DEFAULT(0), 17 | TOSS(1); 18 | 19 | private final int value; 20 | 21 | private IsolationLevel(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static IsolationLevel findByValue(int value) { 37 | switch (value) { 38 | case 0: 39 | return DEFAULT; 40 | case 1: 41 | return TOSS; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/JobOp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum JobOp implements com.facebook.thrift.TEnum { 16 | ADD(1), 17 | SHOW_All(2), 18 | SHOW(3), 19 | STOP(4), 20 | RECOVER(5); 21 | 22 | private final int value; 23 | 24 | private JobOp(int value) { 25 | this.value = value; 26 | } 27 | 28 | /** 29 | * Get the integer value of this enum value, as defined in the Thrift IDL. 30 | */ 31 | public int getValue() { 32 | return value; 33 | } 34 | 35 | /** 36 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 37 | * @return null if the value is not found. 38 | */ 39 | public static JobOp findByValue(int value) { 40 | switch (value) { 41 | case 1: 42 | return ADD; 43 | case 2: 44 | return SHOW_All; 45 | case 3: 46 | return SHOW; 47 | case 4: 48 | return STOP; 49 | case 5: 50 | return RECOVER; 51 | default: 52 | return null; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/JobStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum JobStatus implements com.facebook.thrift.TEnum { 16 | QUEUE(1), 17 | RUNNING(2), 18 | FINISHED(3), 19 | FAILED(4), 20 | STOPPED(5), 21 | INVALID(255); 22 | 23 | private final int value; 24 | 25 | private JobStatus(int value) { 26 | this.value = value; 27 | } 28 | 29 | /** 30 | * Get the integer value of this enum value, as defined in the Thrift IDL. 31 | */ 32 | public int getValue() { 33 | return value; 34 | } 35 | 36 | /** 37 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 38 | * @return null if the value is not found. 39 | */ 40 | public static JobStatus findByValue(int value) { 41 | switch (value) { 42 | case 1: 43 | return QUEUE; 44 | case 2: 45 | return RUNNING; 46 | case 3: 47 | return FINISHED; 48 | case 4: 49 | return FAILED; 50 | case 5: 51 | return STOPPED; 52 | case 255: 53 | return INVALID; 54 | default: 55 | return null; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/JobType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum JobType implements com.facebook.thrift.TEnum { 16 | COMPACT(0), 17 | FLUSH(1), 18 | REBUILD_TAG_INDEX(2), 19 | REBUILD_EDGE_INDEX(3), 20 | REBUILD_FULLTEXT_INDEX(4), 21 | STATS(5), 22 | DATA_BALANCE(6), 23 | DOWNLOAD(7), 24 | INGEST(8), 25 | LEADER_BALANCE(9), 26 | ZONE_BALANCE(10), 27 | UNKNOWN(99); 28 | 29 | private final int value; 30 | 31 | private JobType(int value) { 32 | this.value = value; 33 | } 34 | 35 | /** 36 | * Get the integer value of this enum value, as defined in the Thrift IDL. 37 | */ 38 | public int getValue() { 39 | return value; 40 | } 41 | 42 | /** 43 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 44 | * @return null if the value is not found. 45 | */ 46 | public static JobType findByValue(int value) { 47 | switch (value) { 48 | case 0: 49 | return COMPACT; 50 | case 1: 51 | return FLUSH; 52 | case 2: 53 | return REBUILD_TAG_INDEX; 54 | case 3: 55 | return REBUILD_EDGE_INDEX; 56 | case 4: 57 | return REBUILD_FULLTEXT_INDEX; 58 | case 5: 59 | return STATS; 60 | case 6: 61 | return DATA_BALANCE; 62 | case 7: 63 | return DOWNLOAD; 64 | case 8: 65 | return INGEST; 66 | case 9: 67 | return LEADER_BALANCE; 68 | case 10: 69 | return ZONE_BALANCE; 70 | case 99: 71 | return UNKNOWN; 72 | default: 73 | return null; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/ListHostType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum ListHostType implements com.facebook.thrift.TEnum { 16 | ALLOC(0), 17 | GRAPH(1), 18 | META(2), 19 | STORAGE(3), 20 | AGENT(4), 21 | STORAGE_LISTENER(5), 22 | DRAINER(6), 23 | META_LISTENER(7); 24 | 25 | private final int value; 26 | 27 | private ListHostType(int value) { 28 | this.value = value; 29 | } 30 | 31 | /** 32 | * Get the integer value of this enum value, as defined in the Thrift IDL. 33 | */ 34 | public int getValue() { 35 | return value; 36 | } 37 | 38 | /** 39 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 40 | * @return null if the value is not found. 41 | */ 42 | public static ListHostType findByValue(int value) { 43 | switch (value) { 44 | case 0: 45 | return ALLOC; 46 | case 1: 47 | return GRAPH; 48 | case 2: 49 | return META; 50 | case 3: 51 | return STORAGE; 52 | case 4: 53 | return AGENT; 54 | case 5: 55 | return STORAGE_LISTENER; 56 | case 6: 57 | return DRAINER; 58 | case 7: 59 | return META_LISTENER; 60 | default: 61 | return null; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/ListenerType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum ListenerType implements com.facebook.thrift.TEnum { 16 | UNKNOWN(0), 17 | ELASTICSEARCH(1), 18 | SYNC(2), 19 | ALL(3); 20 | 21 | private final int value; 22 | 23 | private ListenerType(int value) { 24 | this.value = value; 25 | } 26 | 27 | /** 28 | * Get the integer value of this enum value, as defined in the Thrift IDL. 29 | */ 30 | public int getValue() { 31 | return value; 32 | } 33 | 34 | /** 35 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 36 | * @return null if the value is not found. 37 | */ 38 | public static ListenerType findByValue(int value) { 39 | switch (value) { 40 | case 0: 41 | return UNKNOWN; 42 | case 1: 43 | return ELASTICSEARCH; 44 | case 2: 45 | return SYNC; 46 | case 3: 47 | return ALL; 48 | default: 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/QueryStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum QueryStatus implements com.facebook.thrift.TEnum { 16 | RUNNING(1), 17 | KILLING(2); 18 | 19 | private final int value; 20 | 21 | private QueryStatus(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static QueryStatus findByValue(int value) { 37 | switch (value) { 38 | case 1: 39 | return RUNNING; 40 | case 2: 41 | return KILLING; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/RoleType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum RoleType implements com.facebook.thrift.TEnum { 16 | GOD(1), 17 | ADMIN(2), 18 | DBA(3), 19 | USER(4), 20 | GUEST(5), 21 | BASIC(6); 22 | 23 | private final int value; 24 | 25 | private RoleType(int value) { 26 | this.value = value; 27 | } 28 | 29 | /** 30 | * Get the integer value of this enum value, as defined in the Thrift IDL. 31 | */ 32 | public int getValue() { 33 | return value; 34 | } 35 | 36 | /** 37 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 38 | * @return null if the value is not found. 39 | */ 40 | public static RoleType findByValue(int value) { 41 | switch (value) { 42 | case 1: 43 | return GOD; 44 | case 2: 45 | return ADMIN; 46 | case 3: 47 | return DBA; 48 | case 4: 49 | return USER; 50 | case 5: 51 | return GUEST; 52 | case 6: 53 | return BASIC; 54 | default: 55 | return null; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/SnapshotStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum SnapshotStatus implements com.facebook.thrift.TEnum { 16 | VALID(0), 17 | INVALID(1); 18 | 19 | private final int value; 20 | 21 | private SnapshotStatus(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static SnapshotStatus findByValue(int value) { 37 | switch (value) { 38 | case 0: 39 | return VALID; 40 | case 1: 41 | return INVALID; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/meta/TaskResult.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.meta; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum TaskResult implements com.facebook.thrift.TEnum { 16 | SUCCEEDED(0), 17 | FAILED(1), 18 | IN_PROGRESS(2), 19 | INVALID(3); 20 | 21 | private final int value; 22 | 23 | private TaskResult(int value) { 24 | this.value = value; 25 | } 26 | 27 | /** 28 | * Get the integer value of this enum value, as defined in the Thrift IDL. 29 | */ 30 | public int getValue() { 31 | return value; 32 | } 33 | 34 | /** 35 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 36 | * @return null if the value is not found. 37 | */ 38 | public static TaskResult findByValue(int value) { 39 | switch (value) { 40 | case 0: 41 | return SUCCEEDED; 42 | case 1: 43 | return FAILED; 44 | case 2: 45 | return IN_PROGRESS; 46 | case 3: 47 | return INVALID; 48 | default: 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/storage/CatchUpStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.storage; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum CatchUpStatus implements com.facebook.thrift.TEnum { 16 | CAUGHT_UP(1), 17 | WAITING_FOR_SNAPSHOT(2), 18 | RUNNING(3), 19 | STARTING(4); 20 | 21 | private final int value; 22 | 23 | private CatchUpStatus(int value) { 24 | this.value = value; 25 | } 26 | 27 | /** 28 | * Get the integer value of this enum value, as defined in the Thrift IDL. 29 | */ 30 | public int getValue() { 31 | return value; 32 | } 33 | 34 | /** 35 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 36 | * @return null if the value is not found. 37 | */ 38 | public static CatchUpStatus findByValue(int value) { 39 | switch (value) { 40 | case 1: 41 | return CAUGHT_UP; 42 | case 2: 43 | return WAITING_FOR_SNAPSHOT; 44 | case 3: 45 | return RUNNING; 46 | case 4: 47 | return STARTING; 48 | default: 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/storage/EdgeDirection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.storage; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum EdgeDirection implements com.facebook.thrift.TEnum { 16 | BOTH(1), 17 | IN_EDGE(2), 18 | OUT_EDGE(3); 19 | 20 | private final int value; 21 | 22 | private EdgeDirection(int value) { 23 | this.value = value; 24 | } 25 | 26 | /** 27 | * Get the integer value of this enum value, as defined in the Thrift IDL. 28 | */ 29 | public int getValue() { 30 | return value; 31 | } 32 | 33 | /** 34 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 35 | * @return null if the value is not found. 36 | */ 37 | public static EdgeDirection findByValue(int value) { 38 | switch (value) { 39 | case 1: 40 | return BOTH; 41 | case 2: 42 | return IN_EDGE; 43 | case 3: 44 | return OUT_EDGE; 45 | default: 46 | return null; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/storage/EngineSignType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.storage; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum EngineSignType implements com.facebook.thrift.TEnum { 16 | BLOCK_ON(1), 17 | BLOCK_OFF(2); 18 | 19 | private final int value; 20 | 21 | private EngineSignType(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static EngineSignType findByValue(int value) { 37 | switch (value) { 38 | case 1: 39 | return BLOCK_ON; 40 | case 2: 41 | return BLOCK_OFF; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/storage/OrderDirection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.storage; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum OrderDirection implements com.facebook.thrift.TEnum { 16 | ASCENDING(1), 17 | DESCENDING(2); 18 | 19 | private final int value; 20 | 21 | private OrderDirection(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static OrderDirection findByValue(int value) { 37 | switch (value) { 38 | case 1: 39 | return ASCENDING; 40 | case 2: 41 | return DESCENDING; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/storage/ScanType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.storage; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum ScanType implements com.facebook.thrift.TEnum { 16 | PREFIX(1), 17 | RANGE(2); 18 | 19 | private final int value; 20 | 21 | private ScanType(int value) { 22 | this.value = value; 23 | } 24 | 25 | /** 26 | * Get the integer value of this enum value, as defined in the Thrift IDL. 27 | */ 28 | public int getValue() { 29 | return value; 30 | } 31 | 32 | /** 33 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 34 | * @return null if the value is not found. 35 | */ 36 | public static ScanType findByValue(int value) { 37 | switch (value) { 38 | case 1: 39 | return PREFIX; 40 | case 2: 41 | return RANGE; 42 | default: 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/generated/com/vesoft/nebula/storage/StatType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Thrift 3 | * 4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | * @generated 6 | */ 7 | package com.vesoft.nebula.storage; 8 | 9 | 10 | import com.facebook.thrift.IntRangeSet; 11 | import java.util.Map; 12 | import java.util.HashMap; 13 | 14 | @SuppressWarnings({ "unused" }) 15 | public enum StatType implements com.facebook.thrift.TEnum { 16 | SUM(1), 17 | COUNT(2), 18 | AVG(3), 19 | MAX(4), 20 | MIN(5); 21 | 22 | private final int value; 23 | 24 | private StatType(int value) { 25 | this.value = value; 26 | } 27 | 28 | /** 29 | * Get the integer value of this enum value, as defined in the Thrift IDL. 30 | */ 31 | public int getValue() { 32 | return value; 33 | } 34 | 35 | /** 36 | * Find a the enum type by its integer value, as defined in the Thrift IDL. 37 | * @return null if the value is not found. 38 | */ 39 | public static StatType findByValue(int value) { 40 | switch (value) { 41 | case 1: 42 | return SUM; 43 | case 2: 44 | return COUNT; 45 | case 3: 46 | return AVG; 47 | case 4: 48 | return MAX; 49 | case 5: 50 | return MIN; 51 | default: 52 | return null; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/SessionsManagerConfig.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph; 7 | 8 | import com.vesoft.nebula.client.graph.data.HostAddress; 9 | import com.vesoft.nebula.client.graph.net.NebulaPool; 10 | import java.io.Serializable; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | public class SessionsManagerConfig implements Serializable { 15 | 16 | private static final long serialVersionUID = -2460063747630193912L; 17 | 18 | // graphd addresses 19 | private List addresses = new ArrayList<>(); 20 | 21 | // the userName to authenticate graph 22 | private String userName = "root"; 23 | 24 | // the password to authenticate graph 25 | private String password = "nebula"; 26 | 27 | // the space name 28 | private String spaceName = ""; 29 | 30 | // the session needs do reconnect 31 | private Boolean reconnect = true; 32 | 33 | // The config of NebulaConfig 34 | private NebulaPoolConfig poolConfig = new NebulaPoolConfig(); 35 | 36 | public List getAddresses() { 37 | return addresses; 38 | } 39 | 40 | public SessionsManagerConfig setAddresses(List addresses) { 41 | this.addresses = addresses; 42 | return this; 43 | } 44 | 45 | public String getUserName() { 46 | return userName; 47 | } 48 | 49 | public SessionsManagerConfig setUserName(String userName) { 50 | this.userName = userName; 51 | return this; 52 | } 53 | 54 | public String getPassword() { 55 | return password; 56 | } 57 | 58 | public SessionsManagerConfig setPassword(String password) { 59 | this.password = password; 60 | return this; 61 | } 62 | 63 | public String getSpaceName() { 64 | return spaceName; 65 | } 66 | 67 | public SessionsManagerConfig setSpaceName(String spaceName) { 68 | this.spaceName = spaceName; 69 | return this; 70 | } 71 | 72 | public Boolean getReconnect() { 73 | return reconnect; 74 | } 75 | 76 | public void setReconnect(Boolean reconnect) { 77 | this.reconnect = reconnect; 78 | } 79 | 80 | public NebulaPoolConfig getPoolConfig() { 81 | return poolConfig; 82 | } 83 | 84 | public SessionsManagerConfig setPoolConfig(NebulaPoolConfig poolConfig) { 85 | this.poolConfig = poolConfig; 86 | return this; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/BaseDataObject.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import java.io.Serializable; 9 | 10 | public abstract class BaseDataObject implements Serializable { 11 | private String decodeType = "utf-8"; 12 | private int timezoneOffset = 0; 13 | 14 | public String getDecodeType() { 15 | return decodeType; 16 | } 17 | 18 | public BaseDataObject setDecodeType(String decodeType) { 19 | this.decodeType = decodeType; 20 | return this; 21 | } 22 | 23 | public int getTimezoneOffset() { 24 | return timezoneOffset; 25 | } 26 | 27 | public BaseDataObject setTimezoneOffset(int timezoneOffset) { 28 | this.timezoneOffset = timezoneOffset; 29 | return this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/CASignedSSLParam.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | public class CASignedSSLParam extends SSLParam { 9 | private String caCrtFilePath; 10 | private String crtFilePath; 11 | private String keyFilePath; 12 | 13 | public CASignedSSLParam() { 14 | super(SignMode.CA_SIGNED); 15 | } 16 | 17 | public CASignedSSLParam(String caCrtFilePath, String crtFilePath, String keyFilePath) { 18 | super(SignMode.CA_SIGNED); 19 | this.caCrtFilePath = caCrtFilePath; 20 | this.crtFilePath = crtFilePath; 21 | this.keyFilePath = keyFilePath; 22 | } 23 | 24 | public String getCaCrtFilePath() { 25 | return caCrtFilePath; 26 | } 27 | 28 | public String getCrtFilePath() { 29 | return crtFilePath; 30 | } 31 | 32 | public String getKeyFilePath() { 33 | return keyFilePath; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/CoordinateWrapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import com.vesoft.nebula.Coordinate; 9 | import java.util.Arrays; 10 | 11 | public class CoordinateWrapper extends BaseDataObject { 12 | private final Coordinate coordinate; 13 | 14 | public CoordinateWrapper(Coordinate coordinate) { 15 | this.coordinate = coordinate; 16 | } 17 | 18 | public double getX() { 19 | return coordinate.getX(); 20 | } 21 | 22 | public double getY() { 23 | return coordinate.getY(); 24 | } 25 | 26 | @Override 27 | public boolean equals(Object o) { 28 | if (this == o) { 29 | return true; 30 | } 31 | if (o == null || getClass() != o.getClass()) { 32 | return false; 33 | } 34 | CoordinateWrapper that = (CoordinateWrapper) o; 35 | return this.getX() == that.getX() 36 | && this.getY() == that.getY(); 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | StringBuilder sb = new StringBuilder(); 42 | sb.append("COORDINATE"); 43 | sb.append('('); 44 | sb.append(coordinate.getX()); 45 | sb.append(' '); 46 | sb.append(coordinate.getY()); 47 | sb.append(')'); 48 | 49 | return sb.toString(); 50 | } 51 | 52 | @Override 53 | public int hashCode() { 54 | return Arrays.deepHashCode(new Object[] {this.getX(), this.getY()}); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/DateWrapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import com.vesoft.nebula.Date; 9 | import java.util.Objects; 10 | 11 | public class DateWrapper extends BaseDataObject { 12 | private Date date; 13 | 14 | public DateWrapper(Date date) { 15 | this.date = date; 16 | } 17 | 18 | public short getYear() { 19 | return date.getYear(); 20 | } 21 | 22 | public byte getMonth() { 23 | return date.getMonth(); 24 | } 25 | 26 | public byte getDay() { 27 | return date.getDay(); 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return String.format("%d-%02d-%02d", date.year, date.month, date.day); 33 | } 34 | 35 | @Override 36 | public boolean equals(Object o) { 37 | if (this == o) { 38 | return true; 39 | } 40 | if (o == null || getClass() != o.getClass()) { 41 | return false; 42 | } 43 | DateWrapper that = (DateWrapper) o; 44 | return date.year == that.getYear() 45 | && date.month == that.getMonth() 46 | && date.day == that.getDay(); 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | return Objects.hash(date); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/DurationWrapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import com.vesoft.nebula.Duration; 9 | import java.util.Objects; 10 | 11 | public class DurationWrapper extends BaseDataObject { 12 | private final Duration duration; 13 | 14 | /** 15 | * DurationWrapper is a wrapper for the duration type of nebula-graph 16 | */ 17 | public DurationWrapper(Duration duration) { 18 | this.duration = duration; 19 | } 20 | 21 | /** 22 | * @return utc duration seconds 23 | */ 24 | public long getSeconds() { 25 | return duration.seconds; 26 | } 27 | 28 | /** 29 | * @retrun utc duration microseconds 30 | */ 31 | public int getMicroseconds() { 32 | return duration.microseconds; 33 | } 34 | 35 | /** 36 | * @return utc duration months 37 | */ 38 | public int getMonths() { 39 | return duration.months; 40 | } 41 | 42 | /** 43 | * @return the duration string 44 | */ 45 | public String getDurationString() { 46 | return String.format("duration({months:%d, seconds:%d, microseconds:%d})", 47 | getMonths(), getSeconds(), getMicroseconds()); 48 | } 49 | 50 | 51 | @Override 52 | public String toString() { 53 | long totalSeconds = duration.seconds + duration.microseconds / 1000000; 54 | int remainMicroSeconds = duration.microseconds % 1000000; 55 | String microSends = String.format("%06d", remainMicroSeconds) + "000"; 56 | return String.format("P%dMT%d.%sS", duration.months, totalSeconds, microSends); 57 | } 58 | 59 | @Override 60 | public boolean equals(Object o) { 61 | if (this == o) { 62 | return true; 63 | } 64 | if (o == null || getClass() != o.getClass()) { 65 | return false; 66 | } 67 | DurationWrapper that = (DurationWrapper) o; 68 | return duration.months == that.getMonths() 69 | && duration.seconds == that.getSeconds() 70 | && duration.microseconds == that.getMicroseconds(); 71 | } 72 | 73 | @Override 74 | public int hashCode() { 75 | return Objects.hash(duration); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/GeographyWrapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import com.vesoft.nebula.Geography; 9 | import java.util.Objects; 10 | 11 | public class GeographyWrapper extends BaseDataObject { 12 | private final Geography geography; 13 | 14 | public GeographyWrapper(Geography geography) { 15 | this.geography = geography; 16 | } 17 | 18 | public PolygonWrapper getPolygonWrapper() { 19 | return new PolygonWrapper(geography.getPgVal()); 20 | } 21 | 22 | public LineStringWrapper getLineStringWrapper() { 23 | return new LineStringWrapper(geography.getLsVal()); 24 | } 25 | 26 | public PointWrapper getPointWrapper() { 27 | return new PointWrapper(geography.getPtVal()); 28 | } 29 | 30 | @Override 31 | public boolean equals(Object o) { 32 | if (this == o) { 33 | return true; 34 | } 35 | if (o == null || getClass() != o.getClass()) { 36 | return false; 37 | } 38 | GeographyWrapper that = (GeographyWrapper)o; 39 | switch (geography.getSetField()) { 40 | case Geography.PTVAL: 41 | return getPointWrapper().equals(that.getPointWrapper()); 42 | case Geography.LSVAL: 43 | return getLineStringWrapper().equals(that.getLineStringWrapper()); 44 | case Geography.PGVAL: 45 | return getPolygonWrapper().equals(that.getPolygonWrapper()); 46 | default: 47 | return false; 48 | } 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | switch (geography.getSetField()) { 54 | case Geography.PTVAL: 55 | return getPointWrapper().toString(); 56 | case Geography.LSVAL: 57 | return getLineStringWrapper().toString(); 58 | case Geography.PGVAL: 59 | return getPolygonWrapper().toString(); 60 | default: 61 | return ""; 62 | } 63 | } 64 | 65 | @Override 66 | public int hashCode() { 67 | return Objects.hash(geography); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/HostAddress.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import java.io.Serializable; 9 | 10 | public class HostAddress implements Serializable { 11 | private final String host; 12 | private final int port; 13 | 14 | public HostAddress(String host, int port) { 15 | this.host = host; 16 | this.port = port; 17 | } 18 | 19 | public String getHost() { 20 | return host; 21 | } 22 | 23 | public int getPort() { 24 | return port; 25 | } 26 | 27 | @Override 28 | public int hashCode() { 29 | return host.hashCode() + port; 30 | } 31 | 32 | @Override 33 | public boolean equals(Object obj) { 34 | if (this == obj) { 35 | return true; 36 | } 37 | if (obj instanceof HostAddress) { 38 | HostAddress that = (HostAddress) obj; 39 | return this.host.equals(that.host) && this.port == that.port; 40 | } 41 | return false; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return host + ":" + port; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/LineStringWrapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import com.vesoft.nebula.Coordinate; 9 | import com.vesoft.nebula.LineString; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Objects; 13 | 14 | public class LineStringWrapper extends BaseDataObject { 15 | private final LineString lineString; 16 | 17 | public LineStringWrapper(LineString lineString) { 18 | this.lineString = lineString; 19 | } 20 | 21 | public List getCoordinateList() { 22 | List coordList = new ArrayList<>(); 23 | for (Coordinate coord : lineString.getCoordList()) { 24 | coordList.add(new CoordinateWrapper(coord)); 25 | } 26 | return coordList; 27 | } 28 | 29 | @Override 30 | public int hashCode() { 31 | return Objects.hash(lineString); 32 | } 33 | 34 | @Override 35 | public boolean equals(Object o) { 36 | if (this == o) { 37 | return true; 38 | } 39 | if (o == null || getClass() != o.getClass()) { 40 | return false; 41 | } 42 | LineStringWrapper that = (LineStringWrapper) o; 43 | List thisList = getCoordinateList(); 44 | List thatList = that.getCoordinateList(); 45 | if (thisList.size() != thatList.size()) { 46 | return false; 47 | } 48 | for (int i = 0; i < thisList.size(); i++) { 49 | if (!thisList.get(i).equals(thatList.get(i))) { 50 | return false; 51 | } 52 | } 53 | return true; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | StringBuilder sb = new StringBuilder(); 59 | sb.append("LINESTRING"); 60 | sb.append('('); 61 | if (lineString.getCoordList() != null) { 62 | for (Coordinate coordinate : lineString.getCoordList()) { 63 | sb.append(coordinate.getX()); 64 | sb.append(' '); 65 | sb.append(coordinate.getY()); 66 | sb.append(','); 67 | } 68 | if (sb.charAt(sb.length() - 1) == ',') { 69 | sb.deleteCharAt(sb.length() - 1); 70 | } 71 | } 72 | sb.append(')'); 73 | 74 | return sb.toString(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/PointWrapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import com.vesoft.nebula.Coordinate; 9 | import com.vesoft.nebula.Point; 10 | import java.util.Objects; 11 | 12 | public class PointWrapper extends BaseDataObject { 13 | private final Point point; 14 | 15 | public PointWrapper(Point point) { 16 | this.point = point; 17 | } 18 | 19 | public CoordinateWrapper getCoordinate() { 20 | return new CoordinateWrapper(point.getCoord()); 21 | } 22 | 23 | @Override 24 | public boolean equals(Object o) { 25 | if (this == o) { 26 | return true; 27 | } 28 | if (o == null || getClass() != o.getClass()) { 29 | return false; 30 | } 31 | PointWrapper that = (PointWrapper) o; 32 | return this.getCoordinate().equals(that.getCoordinate()); 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | StringBuilder sb = new StringBuilder(); 38 | sb.append("POINT"); 39 | sb.append('('); 40 | Coordinate coordinate = point.getCoord(); 41 | if (coordinate != null) { 42 | sb.append(coordinate.getX()); 43 | sb.append(' '); 44 | sb.append(coordinate.getY()); 45 | } 46 | sb.append(')'); 47 | 48 | return sb.toString(); 49 | } 50 | 51 | @Override 52 | public int hashCode() { 53 | return Objects.hash(point); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/SSLParam.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import java.io.Serializable; 9 | 10 | public abstract class SSLParam implements Serializable { 11 | 12 | private static final long serialVersionUID = 7410233298826490747L; 13 | 14 | private boolean skipVerifyServer = false; 15 | 16 | public enum SignMode { 17 | NONE, 18 | SELF_SIGNED, 19 | CA_SIGNED 20 | } 21 | 22 | private SignMode signMode; 23 | 24 | public boolean isSkipVerifyServer() { 25 | return skipVerifyServer; 26 | } 27 | 28 | public void setSkipVerifyServer(boolean skipVerifyServer) { 29 | this.skipVerifyServer = skipVerifyServer; 30 | } 31 | 32 | public SSLParam(SignMode signMode) { 33 | this.signMode = signMode; 34 | } 35 | 36 | public SignMode getSignMode() { 37 | return signMode; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/SelfSignedSSLParam.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | public class SelfSignedSSLParam extends SSLParam { 9 | private String crtFilePath; 10 | private String keyFilePath; 11 | private String password; 12 | 13 | public SelfSignedSSLParam(String crtFilePath, String keyFilePath, String password) { 14 | super(SignMode.SELF_SIGNED); 15 | this.crtFilePath = crtFilePath; 16 | this.keyFilePath = keyFilePath; 17 | this.password = password; 18 | } 19 | 20 | public String getCrtFilePath() { 21 | return crtFilePath; 22 | } 23 | 24 | public String getKeyFilePath() { 25 | return keyFilePath; 26 | } 27 | 28 | public String getPassword() { 29 | return password; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/data/TimeUtil.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.data; 7 | 8 | import com.vesoft.nebula.DateTime; 9 | import com.vesoft.nebula.Time; 10 | import java.time.LocalDateTime; 11 | import java.time.OffsetDateTime; 12 | import java.time.ZoneOffset; 13 | 14 | public class TimeUtil { 15 | /** 16 | * @param dateTime the utc datetime 17 | * @param timezoneOffset the timezone offset, unit is seconds 18 | * @return the datetime with the timezoneoffset 19 | */ 20 | public static DateTime datetimeConvertWithTimezone(DateTime dateTime, int timezoneOffset) { 21 | LocalDateTime localDateTime = LocalDateTime.of(dateTime.getYear(), 22 | dateTime.getMonth(), 23 | dateTime.getDay(), 24 | dateTime.getHour(), 25 | dateTime.getMinute(), 26 | dateTime.getSec(), 27 | dateTime.getMicrosec() * 1000); 28 | ZoneOffset zoneOffset = ZoneOffset.ofTotalSeconds(timezoneOffset); 29 | OffsetDateTime utcOffsetDateTime = localDateTime.atOffset(ZoneOffset.UTC); 30 | OffsetDateTime localOffsetDateTime = utcOffsetDateTime.withOffsetSameInstant(zoneOffset); 31 | return new DateTime((short) localOffsetDateTime.getYear(), 32 | (byte) localOffsetDateTime.getMonth().getValue(), 33 | (byte) localOffsetDateTime.getDayOfMonth(), 34 | (byte) localOffsetDateTime.getHour(), 35 | (byte) localOffsetDateTime.getMinute(), 36 | (byte) localOffsetDateTime.getSecond(), 37 | localOffsetDateTime.getNano() / 1000); 38 | } 39 | 40 | /** 41 | * @param time the utc time 42 | * @param timezoneOffset the timezone offset, unit is seconds 43 | * @return the time with the timezone offset 44 | */ 45 | public static Time timeConvertWithTimezone(Time time, int timezoneOffset) { 46 | DateTime dateTime = new DateTime( 47 | (short) 0,(byte)1, (byte)1, 48 | time.getHour(), time.getMinute(), time.getSec(), time.getMicrosec()); 49 | DateTime localDateTime = datetimeConvertWithTimezone(dateTime, timezoneOffset); 50 | return new Time(localDateTime.getHour(), 51 | localDateTime.getMinute(), 52 | localDateTime.getSec(), 53 | localDateTime.getMicrosec()); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/AuthFailedException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | /** 9 | * 10 | */ 11 | public class AuthFailedException extends Exception { 12 | public AuthFailedException(String message) { 13 | super(String.format("Auth failed: %s", message)); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/BindSpaceFailedException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | public class BindSpaceFailedException extends Exception { 9 | private static final long serialVersionUID = -8678623814979666625L; 10 | 11 | public BindSpaceFailedException(String message) { 12 | super(String.format("use space failed: %s", message)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/ClientServerIncompatibleException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | /** 9 | * 10 | */ 11 | public class ClientServerIncompatibleException extends Exception { 12 | public ClientServerIncompatibleException(String message) { 13 | super("Current client is not compatible with the remote server, please check the " 14 | + "version: " + message); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/IOErrorException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | /** 9 | * 10 | */ 11 | public class IOErrorException extends java.lang.Exception { 12 | public static final int E_UNKNOWN = 0; 13 | 14 | public static final int E_ALL_BROKEN = 1; 15 | 16 | public static final int E_CONNECT_BROKEN = 2; 17 | 18 | public static final int E_TIME_OUT = 4; 19 | 20 | public static final int E_NO_OPEN = 5; 21 | 22 | private int type = E_UNKNOWN; 23 | 24 | public IOErrorException(int errorType, String message) { 25 | super(message); 26 | this.type = errorType; 27 | } 28 | 29 | public int getType() { 30 | return type; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/InvalidConfigException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | public class InvalidConfigException extends RuntimeException { 9 | public InvalidConfigException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/InvalidSessionException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | public class InvalidSessionException extends RuntimeException { 9 | public InvalidSessionException() { 10 | super("The session was released, could not use again."); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/InvalidValueException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | public class InvalidValueException extends RuntimeException { 9 | public InvalidValueException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/exception/NotValidConnectionException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2019 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.exception; 7 | 8 | /** 9 | * 10 | */ 11 | public class NotValidConnectionException extends Exception { 12 | public NotValidConnectionException(String message) { 13 | super(String.format("No extra connection: %s", message)); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/net/AuthResult.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.net; 7 | 8 | import java.io.Serializable; 9 | 10 | public class AuthResult implements Serializable { 11 | 12 | private static final long serialVersionUID = 8795815613377375650L; 13 | 14 | private final long sessionId; 15 | private final int timezoneOffset; 16 | 17 | public AuthResult(long sessionId, int timezoneOffset) { 18 | this.sessionId = sessionId; 19 | this.timezoneOffset = timezoneOffset; 20 | } 21 | 22 | public long getSessionId() { 23 | return sessionId; 24 | } 25 | 26 | public int getTimezoneOffset() { 27 | return timezoneOffset; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/net/Connection.java: -------------------------------------------------------------------------------- 1 | package com.vesoft.nebula.client.graph.net; 2 | 3 | import com.vesoft.nebula.client.graph.data.HostAddress; 4 | import com.vesoft.nebula.client.graph.data.SSLParam; 5 | import com.vesoft.nebula.client.graph.exception.ClientServerIncompatibleException; 6 | import com.vesoft.nebula.client.graph.exception.IOErrorException; 7 | import java.io.Serializable; 8 | import java.util.Map; 9 | 10 | public abstract class Connection implements Serializable { 11 | 12 | private static final long serialVersionUID = -8425216612015802331L; 13 | 14 | protected HostAddress serverAddr = null; 15 | 16 | public HostAddress getServerAddress() { 17 | return this.serverAddr; 18 | } 19 | 20 | public abstract void open(HostAddress address, int timeout, SSLParam sslParam) 21 | throws IOErrorException, ClientServerIncompatibleException; 22 | 23 | public abstract void open(HostAddress address, int timeout, 24 | SSLParam sslParam, boolean isUseHttp2, Map headers) 25 | throws IOErrorException, ClientServerIncompatibleException; 26 | 27 | 28 | public abstract void open(HostAddress address, int timeout) throws IOErrorException, 29 | ClientServerIncompatibleException; 30 | 31 | public abstract void open(HostAddress address, int timeout, 32 | boolean isUseHttp2, Map headers) 33 | throws IOErrorException, ClientServerIncompatibleException; 34 | 35 | public abstract void reopen() throws IOErrorException, ClientServerIncompatibleException; 36 | 37 | public abstract void close(); 38 | 39 | public abstract boolean ping(); 40 | 41 | public abstract boolean ping(long sessionID); 42 | } 43 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/net/LoadBalancer.java: -------------------------------------------------------------------------------- 1 | package com.vesoft.nebula.client.graph.net; 2 | 3 | import com.vesoft.nebula.client.graph.data.HostAddress; 4 | import com.vesoft.nebula.client.graph.exception.ClientServerIncompatibleException; 5 | 6 | public interface LoadBalancer { 7 | HostAddress getAddress(); 8 | 9 | void close(); 10 | 11 | void updateServersStatus(); 12 | 13 | boolean isServersOK(); 14 | } 15 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/net/SessionState.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.net; 7 | 8 | public enum SessionState { 9 | IDLE, USED 10 | } 11 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/graph/net/SessionWrapper.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.net; 7 | 8 | import com.vesoft.nebula.client.graph.data.ResultSet; 9 | import com.vesoft.nebula.client.graph.exception.IOErrorException; 10 | import com.vesoft.nebula.client.graph.exception.InvalidSessionException; 11 | import java.io.Serializable; 12 | import java.util.concurrent.atomic.AtomicBoolean; 13 | 14 | public class SessionWrapper implements Serializable { 15 | 16 | private static final long serialVersionUID = -8128331485649098264L; 17 | 18 | private final Session session; 19 | private final long sessionID; 20 | private final AtomicBoolean available = new AtomicBoolean(true); 21 | 22 | public SessionWrapper(Session session) { 23 | this.session = session; 24 | this.sessionID = session.getSessionID(); 25 | } 26 | 27 | /** 28 | * Execute the query sentence. 29 | * 30 | * @param stmt The query sentence. 31 | * @return The ResultSet. 32 | */ 33 | public ResultSet execute(String stmt) 34 | throws IOErrorException { 35 | if (!available()) { 36 | throw new InvalidSessionException(); 37 | } 38 | return session.execute(stmt); 39 | } 40 | 41 | public boolean ping() { 42 | return session.pingSession(); 43 | } 44 | 45 | void setNoAvailable() { 46 | this.available.set(false); 47 | } 48 | 49 | boolean available() { 50 | return available.get(); 51 | } 52 | 53 | void release() { 54 | session.release(); 55 | setNoAvailable(); 56 | } 57 | 58 | Session getSession() { 59 | return session; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/meta/AbstractMetaClient.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.meta; 7 | 8 | import com.facebook.thrift.protocol.THeaderProtocol; 9 | import com.facebook.thrift.protocol.TProtocol; 10 | import com.facebook.thrift.transport.THeaderTransport; 11 | import com.facebook.thrift.transport.TTransport; 12 | import com.google.common.base.Preconditions; 13 | import com.google.common.net.InetAddresses; 14 | import com.google.common.net.InternetDomainName; 15 | import com.vesoft.nebula.client.graph.data.HostAddress; 16 | import java.io.Serializable; 17 | import java.net.InetAddress; 18 | import java.net.UnknownHostException; 19 | import java.util.List; 20 | 21 | public class AbstractMetaClient implements Serializable { 22 | protected final List addresses; 23 | protected final int connectionRetry; 24 | protected final int executionRetry; 25 | protected final int timeout; 26 | 27 | protected THeaderProtocol protocol; 28 | protected THeaderTransport transport; 29 | 30 | public AbstractMetaClient(List addresses, int timeout, 31 | int connectionRetry, int executionRetry) throws UnknownHostException { 32 | Preconditions.checkArgument(timeout > 0); 33 | Preconditions.checkArgument(connectionRetry >= 0); 34 | Preconditions.checkArgument(executionRetry >= 0); 35 | for (HostAddress address : addresses) { 36 | String host = InetAddress.getByName(address.getHost()).getHostAddress(); 37 | int port = address.getPort(); 38 | // check if the address is a valid ip, uri address or domain name and port is valid 39 | if (!(InetAddresses.isInetAddress(host) 40 | || InetAddresses.isUriInetAddress(host) 41 | || InternetDomainName.isValid(host)) 42 | || (port <= 0 || port >= 65535)) { 43 | throw new IllegalArgumentException(String.format("%s:%d is not a valid address", 44 | host, port)); 45 | } 46 | } 47 | 48 | this.addresses = addresses; 49 | this.timeout = timeout; 50 | this.connectionRetry = connectionRetry; 51 | this.executionRetry = executionRetry; 52 | } 53 | 54 | public int getConnectionRetry() { 55 | return connectionRetry; 56 | } 57 | 58 | public int getExecutionRetry() { 59 | return executionRetry; 60 | } 61 | 62 | public int getTimeout() { 63 | return timeout; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/meta/MetaCache.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.meta; 7 | 8 | import com.vesoft.nebula.HostAddr; 9 | import com.vesoft.nebula.meta.EdgeItem; 10 | import com.vesoft.nebula.meta.SpaceItem; 11 | import com.vesoft.nebula.meta.TagItem; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | public interface MetaCache { 16 | SpaceItem getSpace(String spaceName); 17 | 18 | TagItem getTag(String spaceName, String tagName); 19 | 20 | EdgeItem getEdge(String spaceName, String edgeName); 21 | 22 | Map> getPartsAlloc(String spaceName); 23 | } 24 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/meta/exception/ExecuteFailedException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.meta.exception; 7 | 8 | public class ExecuteFailedException extends Exception { 9 | public ExecuteFailedException(String message) { 10 | super(String.format("Execute failed: %s", message)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/StorageConnPool.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage; 7 | 8 | import com.vesoft.nebula.client.graph.data.HostAddress; 9 | import java.io.Serializable; 10 | import org.apache.commons.pool2.impl.GenericKeyedObjectPool; 11 | import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | 15 | public class StorageConnPool implements Serializable { 16 | 17 | private static final Logger LOGGER = LoggerFactory.getLogger(StorageConnPool.class); 18 | private static final long serialVersionUID = -6459633350295900558L; 19 | 20 | private final GenericKeyedObjectPool keyedPool; 21 | private final StorageConnPoolFactory poolFactory; 22 | 23 | public StorageConnPool(StoragePoolConfig config) { 24 | poolFactory = new StorageConnPoolFactory(config); 25 | 26 | GenericKeyedObjectPoolConfig poolConfig = new GenericKeyedObjectPoolConfig(); 27 | poolConfig.setMaxIdlePerKey(config.getMaxConnsSize()); 28 | poolConfig.setMinIdlePerKey(config.getMinConnsSize()); 29 | poolConfig.setMinEvictableIdleTimeMillis( 30 | config.getIdleTime() <= 0 ? Long.MAX_VALUE : config.getIdleTime()); 31 | poolConfig.setMaxTotal(config.getMaxTotal()); 32 | poolConfig.setMaxTotalPerKey(config.getMaxTotalPerKey()); 33 | 34 | keyedPool = new GenericKeyedObjectPool<>(poolFactory); 35 | keyedPool.setConfig(poolConfig); 36 | } 37 | 38 | public void close() { 39 | keyedPool.close(); 40 | } 41 | 42 | public GraphStorageConnection getStorageConnection(HostAddress address) throws Exception { 43 | return keyedPool.borrowObject(address); 44 | } 45 | 46 | public void release(HostAddress address, GraphStorageConnection connection) { 47 | keyedPool.returnObject(address, connection); 48 | } 49 | 50 | public int getNumActive(HostAddress address) { 51 | return keyedPool.getNumActive(address); 52 | } 53 | 54 | public int get(HostAddress address) { 55 | return keyedPool.getNumIdle(address); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/StoragePoolConfig.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage; 7 | 8 | import com.vesoft.nebula.client.graph.data.SSLParam; 9 | import java.io.Serializable; 10 | 11 | public class StoragePoolConfig implements Serializable { 12 | 13 | private static final long serialVersionUID = 8022858741090966149L; 14 | 15 | // The min connections in pool for all addresses 16 | private int minConnsSize = 0; 17 | 18 | // The max connections in pool for all addresses 19 | private int maxConnsSize = 10; 20 | 21 | // Socket timeout and Socket connection timeout, unit: millisecond 22 | private int timeout = 0; 23 | 24 | // The idleTime of the connection, unit: millisecond 25 | // The connection's idle time more than idleTime, it will be delete 26 | // 0 means never delete 27 | private int idleTime = 0; 28 | 29 | // the max total connection in pool for all key 30 | private int maxTotal = 50; 31 | 32 | // the max total connection in pool for each key 33 | private int maxTotalPerKey = 10; 34 | 35 | private boolean enableSSL = false; 36 | 37 | private SSLParam sslParam = null; 38 | 39 | public int getMinConnsSize() { 40 | return minConnsSize; 41 | } 42 | 43 | public void setMinConnsSize(int minConnsSize) { 44 | this.minConnsSize = minConnsSize; 45 | } 46 | 47 | public int getMaxConnsSize() { 48 | return maxConnsSize; 49 | } 50 | 51 | public void setMaxConnsSize(int maxConnsSize) { 52 | this.maxConnsSize = maxConnsSize; 53 | } 54 | 55 | public int getTimeout() { 56 | return timeout; 57 | } 58 | 59 | public void setTimeout(int timeout) { 60 | this.timeout = timeout; 61 | } 62 | 63 | public int getIdleTime() { 64 | return idleTime; 65 | } 66 | 67 | public void setIdleTime(int idleTime) { 68 | this.idleTime = idleTime; 69 | } 70 | 71 | public int getMaxTotal() { 72 | return maxTotal; 73 | } 74 | 75 | public void setMaxTotal(int maxTotal) { 76 | this.maxTotal = maxTotal; 77 | } 78 | 79 | public int getMaxTotalPerKey() { 80 | return maxTotalPerKey; 81 | } 82 | 83 | public void setMaxTotalPerKey(int maxTotalPerKey) { 84 | this.maxTotalPerKey = maxTotalPerKey; 85 | } 86 | 87 | public boolean isEnableSSL() { 88 | return enableSSL; 89 | } 90 | 91 | public void setEnableSSL(boolean enableSSL) { 92 | this.enableSSL = enableSSL; 93 | } 94 | 95 | public SSLParam getSslParam() { 96 | return sslParam; 97 | } 98 | 99 | public void setSslParam(SSLParam sslParam) { 100 | this.sslParam = sslParam; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/data/EdgeRow.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.data; 7 | 8 | import com.vesoft.nebula.client.graph.data.ValueWrapper; 9 | import java.io.Serializable; 10 | import java.util.Map; 11 | 12 | public class EdgeRow implements Serializable { 13 | private final ValueWrapper srcId; 14 | private final ValueWrapper dstId; 15 | private final long rank; 16 | private final Map props; 17 | 18 | public EdgeRow(ValueWrapper srcId, ValueWrapper dstId, long rank, 19 | Map props) { 20 | this.srcId = srcId; 21 | this.dstId = dstId; 22 | this.rank = rank; 23 | this.props = props; 24 | } 25 | 26 | public ValueWrapper getSrcId() { 27 | return srcId; 28 | } 29 | 30 | public ValueWrapper getDstId() { 31 | return dstId; 32 | } 33 | 34 | public long getRank() { 35 | return rank; 36 | } 37 | 38 | public Map getProps() { 39 | return props; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "Edge{" 45 | + "srcId='" + srcId.toString() + '\'' 46 | + ", dstId='" + dstId.toString() + '\'' 47 | + ", rank=" + rank 48 | + ", props=" + props 49 | + '}'; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/data/EdgeTableRow.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.data; 7 | 8 | import com.vesoft.nebula.client.graph.data.ValueWrapper; 9 | import java.util.List; 10 | 11 | public class EdgeTableRow extends BaseTableRow { 12 | 13 | public EdgeTableRow(List values) { 14 | super(values); 15 | } 16 | 17 | public EdgeTableRow(List values, String decodeType) { 18 | super(values, decodeType); 19 | } 20 | 21 | public ValueWrapper getSrcId() { 22 | if (values.size() < 3) { 23 | throw new IllegalArgumentException("no src id is returned"); 24 | } 25 | return values.get(0); 26 | } 27 | 28 | 29 | public ValueWrapper getDstId() { 30 | if (values.size() < 3) { 31 | throw new IllegalArgumentException("no dst id is returned"); 32 | } 33 | return values.get(1); 34 | } 35 | 36 | public long getRank() { 37 | if (values.size() < 3) { 38 | throw new IllegalArgumentException("no rank is returned"); 39 | } 40 | return values.get(2).asLong(); 41 | } 42 | 43 | 44 | @Override 45 | public String toString() { 46 | return "EdgeTableView{" 47 | + "srcId=" + getSrcId().toString() 48 | + ", dstId=" + getDstId().toString() 49 | + ", rank=" + getRank() 50 | + ", values=" + getValues() 51 | + '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/data/ScanStatus.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.data; 7 | 8 | public enum ScanStatus { 9 | /** 10 | * all parts succeed 11 | */ 12 | ALL_SUCCESS, 13 | 14 | /** 15 | * part of parts succeed 16 | */ 17 | PART_SUCCESS; 18 | } 19 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/data/VertexRow.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.data; 7 | 8 | import com.vesoft.nebula.client.graph.data.ValueWrapper; 9 | import java.io.Serializable; 10 | import java.util.Map; 11 | 12 | public class VertexRow implements Serializable { 13 | private final ValueWrapper vid; 14 | private final Map props; 15 | 16 | public VertexRow(ValueWrapper vid, Map props) { 17 | this.vid = vid; 18 | this.props = props; 19 | } 20 | 21 | public ValueWrapper getVid() { 22 | return vid; 23 | } 24 | 25 | public Map getProps() { 26 | return props; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "Vertex{" 32 | + "vid=" + vid.toString() 33 | + ", props=" + props 34 | + '}'; 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/data/VertexTableRow.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.data; 7 | 8 | import com.vesoft.nebula.client.graph.data.ValueWrapper; 9 | import java.util.List; 10 | 11 | public class VertexTableRow extends BaseTableRow { 12 | 13 | public VertexTableRow(List values) { 14 | super(values); 15 | } 16 | 17 | public VertexTableRow(List values, String decodeType) { 18 | super(values, decodeType); 19 | } 20 | 21 | /** 22 | * vertex id in vertexTableRow 23 | */ 24 | public ValueWrapper getVid() { 25 | if (values.size() < 1) { 26 | throw new IllegalArgumentException("no vertex id is returned"); 27 | } 28 | return values.get(0); 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return "VertexTableView{" 34 | + "vid=" + getVid().toString() 35 | + ", values=" + mkString(",") 36 | + '}'; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/scan/PartScanInfo.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.scan; 7 | 8 | import com.vesoft.nebula.client.graph.data.HostAddress; 9 | import com.vesoft.nebula.storage.ScanCursor; 10 | import java.io.Serializable; 11 | 12 | public class PartScanInfo implements Serializable { 13 | 14 | private static final long serialVersionUID = 1969725091044874463L; 15 | 16 | private int part; 17 | private HostAddress leader; 18 | private ScanCursor cursor; 19 | 20 | public PartScanInfo(int part, HostAddress leader) { 21 | this.part = part; 22 | this.leader = leader; 23 | cursor = new ScanCursor("".getBytes()); 24 | } 25 | 26 | public int getPart() { 27 | return part; 28 | } 29 | 30 | public void setPart(int part) { 31 | this.part = part; 32 | } 33 | 34 | public HostAddress getLeader() { 35 | return leader; 36 | } 37 | 38 | public void setLeader(HostAddress leader) { 39 | this.leader = leader; 40 | } 41 | 42 | public ScanCursor getCursor() { 43 | return cursor; 44 | } 45 | 46 | public void setCursor(ScanCursor cursor) { 47 | this.cursor = cursor; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "PartScanInfo{" 53 | + "part=" + part 54 | + ", leader=" + leader 55 | + ", cursor=" + new String(cursor.next_cursor) 56 | + '}'; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/client/storage/scan/PartScanQueue.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.scan; 7 | 8 | import com.vesoft.nebula.client.graph.data.HostAddress; 9 | import java.io.Serializable; 10 | import java.util.Set; 11 | 12 | public class PartScanQueue implements Serializable { 13 | 14 | private static final long serialVersionUID = 4817985176727025002L; 15 | 16 | private final Set partScanInfoSet; 17 | 18 | public PartScanQueue(Set partScanInfoSet) { 19 | this.partScanInfoSet = partScanInfoSet; 20 | } 21 | 22 | /** 23 | * get part according to leader 24 | * 25 | * @return null if no match part 26 | */ 27 | public synchronized PartScanInfo getPart(HostAddress leader) { 28 | for (PartScanInfo partScanInfo : partScanInfoSet) { 29 | if (partScanInfo.getLeader().equals(leader)) { 30 | return partScanInfo; 31 | } 32 | } 33 | return null; 34 | } 35 | 36 | /** 37 | * delete part from set 38 | */ 39 | public synchronized void dropPart(PartScanInfo partScanInfo) { 40 | partScanInfoSet.remove(partScanInfo); 41 | } 42 | 43 | public int size() { 44 | return partScanInfoSet.size(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/encoder/NebulaCodec.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.encoder; 7 | 8 | import com.vesoft.nebula.meta.EdgeItem; 9 | import com.vesoft.nebula.meta.TagItem; 10 | import java.util.List; 11 | 12 | public interface NebulaCodec { 13 | byte[] vertexKey(int vidLen, 14 | int partitionId, 15 | byte[] vertexId, 16 | int tagId); 17 | 18 | byte[] orphanVertexKey(int vidLen, 19 | int partitionId, 20 | byte[] vertexId); 21 | 22 | byte[] edgeKey(int vidLen, 23 | int partitionId, 24 | byte[] srcId, 25 | int edgeType, 26 | long edgeRank, 27 | byte[] dstId, 28 | byte edgeVerHolder); 29 | 30 | byte[] edgeKeyByDefaultVer(int vidLen, 31 | int partitionId, 32 | byte[] srcId, 33 | int edgeType, 34 | long edgeRank, 35 | byte[] dstId); 36 | 37 | byte[] encodeTag(TagItem tag, 38 | List names, 39 | List values); 40 | 41 | byte[] encodeEdge(EdgeItem edge, 42 | List names, 43 | List values); 44 | } 45 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/encoder/RowWriter.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.encoder; 7 | 8 | import com.vesoft.nebula.Date; 9 | import com.vesoft.nebula.DateTime; 10 | import com.vesoft.nebula.Geography; 11 | import com.vesoft.nebula.Time; 12 | 13 | public interface RowWriter { 14 | 15 | void write(int index, boolean v); 16 | 17 | void write(int index, float v); 18 | 19 | void write(int index, double v); 20 | 21 | void write(int index, byte[] v); 22 | 23 | void write(int index, byte v); 24 | 25 | void write(int index, short v); 26 | 27 | void write(int index, int v); 28 | 29 | void write(int index, long v); 30 | 31 | void write(int index, Time v); 32 | 33 | void write(int index, Date v); 34 | 35 | void write(int index, DateTime v); 36 | 37 | void write(int index, Geography v); 38 | 39 | byte[] encodeStr(); 40 | } 41 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/encoder/SchemaProvider.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.encoder; 7 | 8 | public interface SchemaProvider { 9 | public interface Field { 10 | public String name(); 11 | 12 | public int type(); 13 | 14 | public boolean nullable(); 15 | 16 | public boolean hasDefault(); 17 | 18 | public byte[] defaultValue(); 19 | 20 | public int size(); 21 | 22 | public int offset(); 23 | 24 | public int nullFlagPos(); 25 | 26 | public int geoShape(); 27 | } 28 | 29 | public long getVersion(); 30 | 31 | public int getNumFields(); 32 | 33 | public int getNumNullableFields(); 34 | 35 | public int size(); 36 | 37 | public int getFieldIndex(String name); 38 | 39 | public String getFiledName(int index); 40 | 41 | public int getFiledType(int index); 42 | 43 | public int getFiledType(String name); 44 | 45 | public Field field(int index); 46 | 47 | public Field field(String index); 48 | 49 | public int fieldSize(int type, int fixedStrLimit); 50 | } 51 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/util/NetUtil.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2024 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.util; 7 | 8 | import com.vesoft.nebula.HostAddr; 9 | 10 | /** 11 | * The util of network 12 | * 13 | * @Author jiangyiwang-jk 14 | * @Date 2024/2/1 15:36 15 | */ 16 | public class NetUtil { 17 | 18 | public static HostAddr parseHostAddr(String hostAddress) { 19 | assert hostAddress != null : "Host address should not be null"; 20 | String[] hostPort = hostAddress.split(":"); 21 | assert hostPort.length == 2 : String.format("Invalid host address %s", hostAddress); 22 | return new HostAddr(hostPort[0].trim(), Integer.parseInt(hostPort[1].trim())); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /client/src/main/java/com/vesoft/nebula/util/ReflectUtil.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2023 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.util; 7 | 8 | import java.lang.reflect.Field; 9 | import java.util.Arrays; 10 | import java.util.Collections; 11 | import java.util.HashSet; 12 | import java.util.List; 13 | import java.util.Set; 14 | 15 | 16 | /** 17 | * The util of reflect 18 | * 19 | * @author yeweicheng 20 | *
Now is history! 21 | */ 22 | public class ReflectUtil { 23 | 24 | /** 25 | * Break through the access rights of the object 26 | * and obtain the specified field value. 27 | * 28 | * @param o object of field value source 29 | * @param field field used for get value 30 | * @return field value in obj 31 | */ 32 | public static Object getValue(Object o, Field field) { 33 | try { 34 | boolean accessible = field.isAccessible(); 35 | if (accessible) { 36 | return field.get(o); 37 | } else { 38 | field.setAccessible(true); 39 | Object value = field.get(o); 40 | field.setAccessible(false); 41 | return value; 42 | } 43 | } catch (IllegalAccessException e) { 44 | throw new RuntimeException(e); 45 | } 46 | } 47 | 48 | /** 49 | * Determine whether parentType is paramType or its parent class or interface 50 | * 51 | * @param paramType type to be determined - subclass 52 | * @param parentType type to be determined - parent class or interface 53 | * @return whether paramType is a subclass or implementation class of parentType 54 | */ 55 | public static boolean isCurrentTypeOrParentType(Class paramType, Class parentType) { 56 | if (paramType == parentType) { 57 | return true; 58 | } 59 | Set> parentTypes = getParentTypes(paramType); 60 | return parentTypes.contains(parentType); 61 | } 62 | 63 | /** 64 | * Get the super class and interface type collection according to paramType. 65 | * 66 | * @param paramType subclass type. 67 | * @return super class and interface. 68 | */ 69 | public static Set> getParentTypes(Class paramType) { 70 | if (paramType == null) { 71 | return Collections.EMPTY_SET; 72 | } 73 | List> interfaces = Arrays.asList(paramType.getInterfaces()); 74 | Set> parents = new HashSet<>(interfaces); 75 | 76 | for (Class anInterface : interfaces) { 77 | parents.addAll(getParentTypes(anInterface)); 78 | } 79 | 80 | Class superclass = paramType.getSuperclass(); 81 | parents.add(superclass); 82 | parents.addAll(getParentTypes(superclass)); 83 | return parents; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /client/src/test/java/com/vesoft/nebula/client/graph/net/TestGraphServiceClient.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.net; 7 | 8 | import com.facebook.thrift.protocol.TCompactProtocol; 9 | import com.facebook.thrift.protocol.TProtocol; 10 | import com.facebook.thrift.transport.TSocket; 11 | import com.facebook.thrift.transport.TTransport; 12 | import com.vesoft.nebula.graph.GraphService; 13 | import java.io.Serializable; 14 | import org.junit.Assert; 15 | import org.junit.Test; 16 | 17 | 18 | public class TestGraphServiceClient { 19 | @Test 20 | public void testClientSerialize() { 21 | 22 | TTransport transport = new TSocket("127.0.0.1", 9669, 10000, 10000); 23 | TProtocol protocol = new TCompactProtocol(transport); 24 | GraphService.Client client = new GraphService.Client(protocol); 25 | 26 | if (!(client instanceof Serializable)) { 27 | System.out.println("GraphService.Client is not serialized."); 28 | Assert.assertFalse("GraphService.Client is not serialized, " 29 | + "please modify the thrift file manually", false); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /client/src/test/java/com/vesoft/nebula/client/graph/net/TestSyncConnection.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.graph.net; 7 | 8 | import com.vesoft.nebula.ErrorCode; 9 | import com.vesoft.nebula.client.graph.data.HostAddress; 10 | import com.vesoft.nebula.graph.ExecutionResponse; 11 | import org.junit.Assert; 12 | import org.junit.Test; 13 | 14 | public class TestSyncConnection { 15 | @Test(timeout = 3000) 16 | public void testAll() { 17 | try { 18 | // Test open 19 | SyncConnection connection = new SyncConnection(); 20 | connection.open(new HostAddress("127.0.0.1", 9671), 1000); 21 | 22 | // Test authenticate 23 | AuthResult authResult = connection.authenticate("root", "nebula"); 24 | Assert.assertNotEquals(0, authResult.getSessionId()); 25 | 26 | // Test execute 27 | ExecutionResponse resp = connection.execute(authResult.getSessionId(), "SHOW SPACES;"); 28 | Assert.assertEquals(ErrorCode.SUCCEEDED, resp.error_code); 29 | 30 | // Test signout 31 | connection.signout(authResult.getSessionId()); 32 | 33 | try { 34 | connection.execute(authResult.getSessionId(), "SHOW SPACES;"); 35 | } catch (Exception e) { 36 | assert (true); 37 | } 38 | 39 | connection.close(); 40 | 41 | try { 42 | connection.authenticate("root", "nebula"); 43 | } catch (Exception e) { 44 | assert (true); 45 | } 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | assert (false); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /client/src/test/java/com/vesoft/nebula/client/storage/StorageConnPoolTest.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage; 7 | 8 | import com.facebook.thrift.TException; 9 | import com.vesoft.nebula.client.graph.data.HostAddress; 10 | import java.util.Arrays; 11 | import java.util.List; 12 | import junit.framework.TestCase; 13 | import org.junit.Assert; 14 | 15 | public class StorageConnPoolTest extends TestCase { 16 | 17 | private StorageConnPool pool; 18 | 19 | public void setUp() throws Exception { 20 | super.setUp(); 21 | testPoolInit(); 22 | } 23 | 24 | public void tearDown() throws Exception { 25 | } 26 | 27 | public void testFreshCache() { 28 | 29 | } 30 | 31 | public void testPoolInit() { 32 | // invalidate host 33 | try { 34 | List address = Arrays.asList(new HostAddress("hostname", 9559)); 35 | StoragePoolConfig config = new StoragePoolConfig(); 36 | config.setMaxTotal(20); 37 | config.setMaxTotalPerKey(8); 38 | StorageConnPool pool = new StorageConnPool(config); 39 | } catch (IllegalArgumentException e) { 40 | Assert.assertTrue(true); 41 | } 42 | 43 | // normal 44 | try { 45 | List address = Arrays.asList( 46 | new HostAddress("127.0.0.1", 9559), 47 | new HostAddress("127.0.0.1", 9560), 48 | new HostAddress("127.0.0.1", 9561) 49 | ); 50 | StoragePoolConfig config = new StoragePoolConfig(); 51 | pool = new StorageConnPool(config); 52 | assertEquals(pool.getNumActive(new HostAddress("127.0.0.1", 9559)), 0); 53 | } catch (Exception e) { 54 | e.printStackTrace(); 55 | fail(); 56 | } 57 | } 58 | 59 | 60 | public void testGetConnection() { 61 | try { 62 | List address = Arrays.asList(new HostAddress("127.0.0.1", 63 | 9559)); 64 | StoragePoolConfig config = new StoragePoolConfig(); 65 | pool = new StorageConnPool(config); 66 | pool.getStorageConnection(address.get(0)); 67 | 68 | assertEquals(pool.getNumActive(address.get(0)), 1); 69 | } catch (Exception e) { 70 | e.printStackTrace(); 71 | assertFalse(true); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /client/src/test/java/com/vesoft/nebula/client/storage/processor/VertexProcessorTest.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.processor; 7 | 8 | import com.vesoft.nebula.DataSet; 9 | import com.vesoft.nebula.client.graph.data.PointWrapper; 10 | import com.vesoft.nebula.client.graph.data.ValueWrapper; 11 | import com.vesoft.nebula.client.storage.MockUtil; 12 | import com.vesoft.nebula.client.storage.data.VertexRow; 13 | import com.vesoft.nebula.client.storage.data.VertexTableRow; 14 | import java.io.UnsupportedEncodingException; 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | import java.util.Map; 18 | import org.junit.Test; 19 | 20 | public class VertexProcessorTest { 21 | 22 | @Test 23 | public void testConstructVertexRow() { 24 | List dataSets = MockUtil.mockVertexDataSets(); 25 | Map vertexRows = VertexProcessor.constructVertexRow(dataSets, 26 | "utf-8"); 27 | List rows = new ArrayList<>(vertexRows.values()); 28 | assert (vertexRows.size() == dataSets.get(0).getRows().size()); 29 | try { 30 | assert (rows.get(0).getVid().asString().equals("Tom")); 31 | } catch (UnsupportedEncodingException e) { 32 | e.printStackTrace(); 33 | assert (false); 34 | } 35 | assert (rows.get(0).getProps().size() == 7); 36 | assert (rows.get(0).getProps().containsKey("boolean_col1")); 37 | assert (rows.get(0).getProps().containsKey("long_col2")); 38 | } 39 | 40 | @Test 41 | public void testConstructEdgeTableRow() { 42 | List dataSets = MockUtil.mockVertexDataSets(); 43 | List tableRows = VertexProcessor 44 | .constructVertexTableRow(dataSets, "utf-8"); 45 | assert (tableRows.size() == dataSets.get(0).getRows().size()); 46 | assert (tableRows.get(0).getValues().size() == 8); 47 | try { 48 | assert (tableRows.get(0).getVid().asString().equals("Tom")); 49 | assert (tableRows.get(0).getString(0).equals("Tom")); 50 | } catch (UnsupportedEncodingException e) { 51 | assert (false); 52 | } 53 | assert (tableRows.get(0).getBoolean(1)); 54 | assert (tableRows.get(0).getLong(2) == 12); 55 | assert (tableRows.get(0).getDouble(3) < 1.1); 56 | assert (tableRows.get(0).getDate(4).getYear() == 2020); 57 | assert (tableRows.get(0).getTime(5).getSecond() == 1); 58 | assert (tableRows.get(0).getDateTime(6).getDay() == 1); 59 | assert (tableRows.get(0).getGeography(7).getPointWrapper().getCoordinate().getX() == 1.0); 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /client/src/test/java/com/vesoft/nebula/client/storage/scan/PartScanQueueTest.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.storage.scan; 7 | 8 | import com.vesoft.nebula.client.graph.data.HostAddress; 9 | import com.vesoft.nebula.storage.ScanCursor; 10 | import java.util.HashSet; 11 | import java.util.Set; 12 | import org.junit.Before; 13 | import org.junit.Test; 14 | 15 | public class PartScanQueueTest { 16 | 17 | PartScanQueue queue; 18 | 19 | @Before 20 | public void before() { 21 | Set partScanInfoSet = mockPartScanInfo(); 22 | queue = new PartScanQueue(partScanInfoSet); 23 | } 24 | 25 | @Test 26 | public void testGetPart() { 27 | // test invalidate leader 28 | HostAddress wrongAddr = new HostAddress("1.1.1.1", 1); 29 | assert (queue.getPart(wrongAddr) == null); 30 | 31 | // test validate leader 32 | HostAddress rightAddr = new HostAddress("127.0.0.1", 1); 33 | assert (queue.getPart(rightAddr).getLeader().getPort() == 1); 34 | assert ("".equals(new String(queue.getPart(rightAddr).getCursor().next_cursor))); 35 | 36 | // test cursor 37 | HostAddress addr = new HostAddress("127.0.0.1", 3); 38 | assert (queue.getPart(addr).getLeader().getPort() == 3); 39 | assert (new String(queue.getPart(addr).getCursor().next_cursor).equals("cursor")); 40 | } 41 | 42 | @Test 43 | public void testDropPart() { 44 | // drop not existed part 45 | queue.dropPart(new PartScanInfo(1, new HostAddress("127.0.0.1", 1))); 46 | assert (queue.size() == 5); 47 | 48 | // drop existed part 49 | HostAddress addr = new HostAddress("127.0.0.1", 3); 50 | PartScanInfo partScanInfo = queue.getPart(addr); 51 | queue.dropPart(partScanInfo); 52 | assert (queue.size() == 4); 53 | } 54 | 55 | 56 | private Set mockPartScanInfo() { 57 | Set partScanInfoSet = new HashSet<>(); 58 | partScanInfoSet.add(new PartScanInfo(1, new HostAddress("127.0.0.1", 1))); 59 | partScanInfoSet.add(new PartScanInfo(2, new HostAddress("127.0.0.1", 2))); 60 | partScanInfoSet.add(new PartScanInfo(3, new HostAddress("127.0.0.1", 1))); 61 | partScanInfoSet.add(new PartScanInfo(4, new HostAddress("127.0.0.1", 2))); 62 | 63 | PartScanInfo partScanInfo = new PartScanInfo(5, new HostAddress("127.0.0.1", 3)); 64 | partScanInfo.setCursor(new ScanCursor("cursor".getBytes())); 65 | partScanInfoSet.add(partScanInfo); 66 | return partScanInfoSet; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /client/src/test/java/com/vesoft/nebula/client/util/ProcessUtil.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021 vesoft inc. All rights reserved. 2 | * 3 | * This source code is licensed under Apache 2.0 License. 4 | */ 5 | 6 | package com.vesoft.nebula.client.util; 7 | 8 | import java.io.BufferedReader; 9 | import java.io.InputStreamReader; 10 | 11 | public class ProcessUtil { 12 | public static void printProcessStatus(String cmd, Process p) { 13 | try { 14 | BufferedReader reader = new BufferedReader( 15 | new InputStreamReader(p.getInputStream())); 16 | 17 | String line; 18 | System.out.print(cmd + " output: "); 19 | while ((line = reader.readLine()) != null) { 20 | System.out.print(line); 21 | } 22 | System.out.print("\n"); 23 | } catch (Exception e) { 24 | e.printStackTrace(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /client/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | log4j.rootLogger=INFO, stdout 3 | # Console output... 4 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 7 | -------------------------------------------------------------------------------- /client/src/test/resources/ssl/client.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB7zCCAVigAwIBAgIJANICg/BfzBRwMA0GCSqGSIb3DQEBCwUAMC4xCzAJBgNV 3 | BAYTAkNIMRAwDgYDVQQKDAd0ZXN0LWNhMQ0wCwYDVQQDDARyb290MB4XDTIzMTIx 4 | NDA1NTQyNVoXDTMzMTIxMTA1NTQyNVowMDELMAkGA1UEBhMCQ0gxEDAOBgNVBAoM 5 | B3Rlc3QtY2ExDzANBgNVBAMMBmNsaWVudDCBnzANBgkqhkiG9w0BAQEFAAOBjQAw 6 | gYkCgYEA39sbcC9hhpIL2jSJUtW5hw81YzdA7iKXKVuh91O8UWRpeWzQpx+ysvUT 7 | xQJxrxYrOXqGsaNtR1QJeKFla1XKFVCJTsIOcrdRTp1JCDrdLrQl0NDV1yrUy+d7 8 | TTSQDfTAhTmAZ37r05XUumPmbjSKET3AunxCewBgRenFbmeIyjkCAwEAAaMTMBEw 9 | DwYDVR0RBAgwBocEfwAAATANBgkqhkiG9w0BAQsFAAOBgQCfnKFzTFDuFPtR7FqH 10 | 5xrRW21oAmwh89ip8uuWbBU9lQkva8Yt9UPaOdnsMYw0Nv6gpPiZbEa4r2xOhnmS 11 | 2iRK0UNWKbtQnz4sI0uQ9frF6bFZkoz43f41aqijI/GNiAe9MhjaoJ0GEhaXBTnc 12 | Vagc6pPL9BmmroVnrFJD4feZFw== 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /client/src/test/resources/ssl/client.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICWQIBAAKBgQDf2xtwL2GGkgvaNIlS1bmHDzVjN0DuIpcpW6H3U7xRZGl5bNCn 3 | H7Ky9RPFAnGvFis5eoaxo21HVAl4oWVrVcoVUIlOwg5yt1FOnUkIOt0utCXQ0NXX 4 | KtTL53tNNJAN9MCFOYBnfuvTldS6Y+ZuNIoRPcC6fEJ7AGBF6cVuZ4jKOQIDAQAB 5 | An8EX0Mp7cL53eBdYqlL9OCqwqFITsv12rcZF7ESI5CKBmwI8xcgLH5RAHhiYKnX 6 | wZcWiE4ZKhf4TKvir0RL1GEeABiorN04xb6+UFtoqHhOffB70iJA6PnDRq20f+p/ 7 | fwTubSx+0rP3udpVQXrgp32ZpMb9wALAbNhHuFiGGgi1AkEA+bVTZ4Q+/6N+LiHz 8 | Vrsgn9thUp9O+uONaK33/Mo4cPhLX48i1Z+oDqiwyYnO6eTfGjflttQYC2a+852t 9 | uxS20wJBAOV/BwyPeYYtAJ01R1C9dm4Ye8T/hfEB/mg0sn5fjTYYvKFbqzi9SMOP 10 | anC8MgSYK0NoU17uTKM70G+03PZKq0MCQFIcC9boJ4cMDbvBsjB8y9eE3dW7SM86 11 | 8A7R1c+r9y8+lhpQCNZR74MSeT9sLzu95JbMdp7N0zI8kOGuoaf4wb0CQF94+PXA 12 | uk2Xayn7gC+Woi4rAVJy+sXIjo3LXnY0Sgq3P8Hg4No55It2nlFH+Ybvxw/D1usn 13 | N7qwp4XROBs99QECQA/AAN5jRIa8+yHgkWiHrjDYvV2tB+bQTWAuWbLPJxhHeu5m 14 | u9AL/UyuM956FrjNbOYmWq3od7o/386QLGk3Vqs= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /client/src/test/resources/ssl/root.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICbjCCAdegAwIBAgIJANZkwYfoTzotMA0GCSqGSIb3DQEBCwUAMC4xCzAJBgNV 3 | BAYTAkNIMRAwDgYDVQQKDAd0ZXN0LWNhMQ0wCwYDVQQDDARyb290MB4XDTIzMTIx 4 | NDA1NTMyNloXDTMzMTIxMTA1NTMyNlowLjELMAkGA1UEBhMCQ0gxEDAOBgNVBAoM 5 | B3Rlc3QtY2ExDTALBgNVBAMMBHJvb3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ 6 | AoGBALfWl87aVoheMJbIkHgC27jBv1OrpIYA/zLWvvRzy26qAE9iqPMV633+/jnx 7 | jFADCr8CDdhLQBL55hXruJG6zGqNumB+184QmaVbYFWH6BurNBo2M42NunSIwObx 8 | ucb6B0nEDEaVbCgiSqd3vn/Fzslc3BTdvSpsYfLSkgCDkbMzAgMBAAGjgZMwgZAw 9 | DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUlQdYCxGidv4pQHLQ6xnDJTmYIU0w 10 | XgYDVR0jBFcwVYAUlQdYCxGidv4pQHLQ6xnDJTmYIU2hMqQwMC4xCzAJBgNVBAYT 11 | AkNIMRAwDgYDVQQKDAd0ZXN0LWNhMQ0wCwYDVQQDDARyb290ggkA1mTBh+hPOi0w 12 | DQYJKoZIhvcNAQELBQADgYEAe2tXEuegJIwlvzCrYZat1BJqWVY1aMGwGAfVyLMV 13 | AepF7dOrC+e11vvJAkXxRDntLKIWRPMT+XztFaOciBAbmHMm7EptsRL6v+8BBzKO 14 | 9Sx2eofPhmbiNtMTqXU7TEtuV5Lqn2arF2xIdYxexT13bSHiSgOGkd/tDmbf4CTJ 15 | b4c= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /client/src/test/resources/ssl/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICFTCCAX6gAwIBAgIJANICg/BfzBRuMA0GCSqGSIb3DQEBCwUAMC4xCzAJBgNV 3 | BAYTAkNIMRAwDgYDVQQKDAd0ZXN0LWNhMQ0wCwYDVQQDDARyb290MB4XDTIzMTIx 4 | NDA1NTQxMloXDTMzMTIxMTA1NTQxMlowMDELMAkGA1UEBhMCQ0gxEDAOBgNVBAoM 5 | B3Rlc3QtY2ExDzANBgNVBAMMBnNlcnZlcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAw 6 | gYkCgYEAv451pRKKXKTvNxEr2rL8zRJ6M7rZbMzMnN8IPl2ACg0Y6eekGNtMCd4I 7 | qybMhKJFsYTwM0rsTZgt+i5Omcat1NHKebeqIz93YtX149Bd2r+lSt5EfMbocMAP 8 | dUlK4Toa3LNfyrtVrEqbxF6vCByQ3Sen6QDV8dUBC2Jm4atYff0CAwEAAaM5MDcw 9 | NQYDVR0RBC4wLIcEfwAAAYIJbG9jYWxob3N0ggdncmFwaGQwggdncmFwaGQxggdn 10 | cmFwaGQyMA0GCSqGSIb3DQEBCwUAA4GBAFZ9Uk9pS7La401+bmPN6H5z4JCXhYRc 11 | j4OELU+jt+YjURyvO6bFaHIabpo1U7abw6C81maSvLd/QamL37UWUpcH3kHL9YDy 12 | ime2lEbA5Z8dU8u9ZW/tuLgMkrkn0Sg0S55zoel/i7Ds/4tnK7RLEF/WHjHXmVNh 13 | oxV6CeJpHnBd 14 | -----END CERTIFICATE----- 15 | -------------------------------------------------------------------------------- /client/src/test/resources/ssl/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXQIBAAKBgQC/jnWlEopcpO83ESvasvzNEnozutlszMyc3wg+XYAKDRjp56QY 3 | 20wJ3girJsyEokWxhPAzSuxNmC36Lk6Zxq3U0cp5t6ojP3di1fXj0F3av6VK3kR8 4 | xuhwwA91SUrhOhrcs1/Ku1WsSpvEXq8IHJDdJ6fpANXx1QELYmbhq1h9/QIDAQAB 5 | AoGBAJKgRFMPxxM1ONqo7S2hdjqvGxU/wDA076ZgXloGjfyjm99nbUeNjT28VFxV 6 | /ZTE9Z31iTtp7UlT5FWtXoL8/o8k0HcOgWVUbSgTBSHaIbqq3Yu6XM9HlOFv9fBX 7 | 3QprYbQd/xC5bDfl9Ez/hlMKRBBFtps5SsF7evc2DfFC3KsNAkEA92ykL1Nz2Z3m 8 | pu74xbXRhTjIOGN2n3E4+0a2o2bVePGIFBgtCibWSPs4QVxil0VPzYvx351LuOR0 9 | TVH0H0DxKwJBAMYyHGPdMKGUXYcyx8ryEZBRtJ0MO/xC84EpB5K7SRjzUj7inutj 10 | z2rT5+AWoBu7CxHIZCd5BsCS8wafq8dZqXcCQGOVBUvK8cCvbarYWaXxdL+CyArx 11 | 9Udc4Ys4vb9sXxTLWXKE/HOuh+ZdvhmIXmH10pWu8o2GmHh08l5AUtnVYHsCQQDC 12 | U+vmNsAyDYjOwQmIgWSbPqF6wr4mD3c2Ewar5ho77oebxRPQ9OIwemmGHGkMB49I 13 | 9lTNJytpsiu7ON9y7QTtAkAj3jc5NXoSn4HXTg6tKm9HJKT6ZSSo/UbS6zUePsUw 14 | hl0yBmRdwTYdDuHbLIaMP+KRppnPRyVIf9aasuSv4T2o 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /client/src/test/resources/ssl/server.password: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vesoft-inc/nebula-java/38c410ecce56008f784e8c11cd80a483537c02ec/client/src/test/resources/ssl/server.password -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "client/src/main/generated" 3 | - "client/src/main/fbthrift" -------------------------------------------------------------------------------- /examples/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | log4j.rootLogger=INFO, stdout 3 | # Console output... 4 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 5 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n 7 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/casigned.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICljCCAX4CCQC9uuUY+ah8qzANBgkqhkiG9w0BAQsFADANMQswCQYDVQQGEwJD 3 | TjAeFw0yMTA5MjkwNzM4MDRaFw0yNDAxMDIwNzM4MDRaMA0xCzAJBgNVBAYTAkNO 4 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuo7hKpcs+VQKbGRq0fUL 5 | +GcSfPfJ8mARtIeI8WfU0j1vI5KNujI//G2olOGEueDCw4OO0UbdjnsFpgj2awAo 6 | rj4ga2W6adQHK8qHY6q/Rdqv0oDCrcePMtQ8IwbFjNWOXC4bn7GcV7mzOkigdcj8 7 | UPkSeaqI9XxBRm3OoDX+T8h6cDLrm+ncKB8KKe/QApKH4frV3HYDqGtN49zuRs6F 8 | iurFbXDGVAZEdFEJl38IQJdmE2ASOzEHZbxWKzO/DZr/Z2+L1CuycZIwuITcnddx 9 | b2Byx/opwX4HlyODeUBbyDp+hd+GkasmIcpOlIDw9OXIvrcajKvzLEbqGt2ThsxX 10 | QwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAxzxtbYBQ2WgBGrpzOX4TxsuSaigqo 11 | YJ5zbVEHtwbsbBTZ7UJvRc9IyhrOL5Ui4PJI85chh1GpGqOmMoYSaWdddaIroilQ 12 | 56bn5haB8ezAMnLXbPuf97UENO0RIkyzt63XPIUkDnwlzOukIq50qgsYEDuiioM/ 13 | wpCqSbMJ4iK/SlSSUWw3cKuAHvFfLv7hkC6AhvT7yfaCNDs29xEQUCD12XlIdFGH 14 | FjMgVMcvcIePQq5ZcmSfVMge9jPjPx/Nj9SVauF5z5pil9qHG4jyXPGThiiJ3CE4 15 | GU5d/Qfe7OeiYI3LaoVufZ5pZnR9nMnpzqU46w9gY7vgi6bAhNwsCDr3 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/casigned.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEAuo7hKpcs+VQKbGRq0fUL+GcSfPfJ8mARtIeI8WfU0j1vI5KN 3 | ujI//G2olOGEueDCw4OO0UbdjnsFpgj2awAorj4ga2W6adQHK8qHY6q/Rdqv0oDC 4 | rcePMtQ8IwbFjNWOXC4bn7GcV7mzOkigdcj8UPkSeaqI9XxBRm3OoDX+T8h6cDLr 5 | m+ncKB8KKe/QApKH4frV3HYDqGtN49zuRs6FiurFbXDGVAZEdFEJl38IQJdmE2AS 6 | OzEHZbxWKzO/DZr/Z2+L1CuycZIwuITcnddxb2Byx/opwX4HlyODeUBbyDp+hd+G 7 | kasmIcpOlIDw9OXIvrcajKvzLEbqGt2ThsxXQwIDAQABAoIBAH4SEBe4EaxsHp8h 8 | PQ6linFTNis9SDuCsHRPIzv/7tIksfZYE27Ahn0Pndz+ibMTMIrvXJQQT6j5ede6 9 | NswYT2Vwlnf9Rvw9TJtLQjMYMCoEnsyiNu047oxq4DjLWrTRnGKuxfwlCoI9++Bn 10 | NAhkyh3uM44EsIk0bugpTHj4A+PlbUPe7xdEI/6XpaZrRN9oiejJ4VxZAPgFGiTm 11 | uNF5qg16+0900Pfj5Y/M4vXmn+gq39PO/y0FlTpaoEuYZiZZS3xHGmSVhlt8LIgI 12 | 8MdMRaKTfNeNITaqgOWh9pAW4xmK48/KfLgNPQgtDHjMJpgM0BbcBOayOY8Eio0x 13 | Z66G2AECgYEA9vj/8Fm3CKn/ogNOO81y9kIs0iPcbjasMnQ3UXeOdD0z0+7TM86F 14 | Xj3GK/z2ecvY7skWtO5ZUbbxp4aB7omW8Ke9+q8XPzMEmUuAOTzxQkAOxdr++HXP 15 | TILy0hNX2cmiLQT1U60KoZHzPZ5o5hNIQPMt7hN12ERWcIfR/MUZa5UCgYEAwWCP 16 | 6Y7Zso1QxQR/qfjuILET3/xU+ZmqSRDvzJPEiGI3oeWNG4L6cKR+XTe0FWZBAmVk 17 | Qq/1qXmdBnf5S7azffoJe2+H/m3kHJSprIiAAWlBN2e+kFlNfBhtkgia5NvsrjRw 18 | al6mf/+weRD1FiPoZY3e1wBKoqro7aI8fE5gwXcCgYEAnEI05OROeyvb8qy2vf2i 19 | JA8AfsBzwkPTNWT0bxX+yqrCdO/hLyEWnubk0IYPiEYibgpK1JUNbDcctErVQJBL 20 | MN5gxBAt3C2yVi8/5HcbijgvYJ3LvnYDf7xGWAYnCkOZ2XQOqC+Oz2UhijYE1rUS 21 | fQ2fXMdxQzERo8c7Y/tstvUCgYBuixy5jwezokUB20h/ieXWmmOaL00EQmutyRjM 22 | AczfigXzbp3zlDRGIEJ8V1OCyClxjTR7SstMTlENWZgRSCfjZAP3pBJBx+AW1oUI 23 | NB+4rsqxOYUeT26T+gLo8DJbkb0C+Mcqh2D22tuu2ZrBRVWceDVjAq+nvbvZ3Fxn 24 | UwbMkQKBgQCxL3aA6ART6laIxT/ZqMhV0ZcaoDJogjF+4I4bhlO4ivWGWJ4RpEDn 25 | ziFb6+M/4pe4vCou9yuAof6WTKM8JG4rok0yxhN3V6QGP49TjtrfkkrEPCtB2LSI 26 | N1+YRSTrS5VDcl8h8JH7fpghRnXHONEyIqasYVqsbxKzNyLV/z2rkw== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/casigned.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEGzCCAwOgAwIBAgIUDcmZFpL4PcdCXfLRBK8bR2vb39cwDQYJKoZIhvcNAQEL 3 | BQAwgZwxCzAJBgNVBAYTAkNOMREwDwYDVQQIDAhaaGVqaWFuZzERMA8GA1UEBwwI 4 | SGFuZ3pob3UxFDASBgNVBAoMC1Zlc29mdCBJbmMuMRAwDgYDVQQLDAdzZWN0aW9u 5 | MRYwFAYDVQQDDA1zaHlsb2NrIGh1YW5nMScwJQYJKoZIhvcNAQkBFhhzaHlsb2Nr 6 | Lmh1YW5nQHZlc29mdC5jb20wHhcNMjEwODE5MDkyNDQ3WhcNMjUwODE4MDkyNDQ3 7 | WjCBnDELMAkGA1UEBhMCQ04xETAPBgNVBAgMCFpoZWppYW5nMREwDwYDVQQHDAhI 8 | YW5nemhvdTEUMBIGA1UECgwLVmVzb2Z0IEluYy4xEDAOBgNVBAsMB3NlY3Rpb24x 9 | FjAUBgNVBAMMDXNoeWxvY2sgaHVhbmcxJzAlBgkqhkiG9w0BCQEWGHNoeWxvY2su 10 | aHVhbmdAdmVzb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB 11 | AMEAgpamCQHl+8JnUHI6/VmJHjDLYJLTliN/CwpFrhMqIVjJ8wG57WYLpXpn91Lz 12 | eHu52LkVzcikybIJ2a+LOTvnhNFdbmTbqDtrb+s6wM/sO+nF6tU2Av4e5zhyKoeR 13 | LL+rHMk3nymohbdN4djySFmOOU5A1O/4b0bZz4Ylu995kUawdiaEo13BzxxOC7Ik 14 | Gge5RyDcm0uLXZqTAPy5Sjv/zpOyj0AqL1CJUH7XBN9OMRhVU0ZX9nHWl1vgLRld 15 | J6XT17Y9QbbHhCNEdAmFE5kEFgCvZc+MungUYABlkvoj86TLmC/FMV6fWdxQssyd 16 | hS+ssfJFLaTDaEFz5a/Tr48CAwEAAaNTMFEwHQYDVR0OBBYEFK0GVrQx+wX1GCHy 17 | e+6fl4X+prmYMB8GA1UdIwQYMBaAFK0GVrQx+wX1GCHye+6fl4X+prmYMA8GA1Ud 18 | EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHqP8P+ZUHmngviHLSSN1ln5 19 | Mx4BCkVeFRUaFx0yFXytV/iLXcG2HpFg3A9rAFoYgCDwi1xpsERnBZ/ShTv/eFOc 20 | IxBY5yggx3/lGi8tAgvUdarhd7mQO67UJ0V4YU3hAkbnZ8grHHXj+4hfgUpY4ok6 21 | yaed6HXwknBb9W8N1jZI8ginhkhjaeRCHdMiF+fBvNCtmeR1bCml1Uz7ailrpcaT 22 | Mf84+5VYuFEnaRZYWFNsWNCOBlJ/6/b3V10vMXzMmYHqz3xgAq0M3fVTFTzopnAX 23 | DLSzorL/dYVdqEDCQi5XI9YAlgWN4VeGzJI+glkLOCNzHxRNP6Qev+YI+7Uxz6I= 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/root.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDiTCCAnGgAwIBAgIUEXgJM36pHqMj9xpMOV+bIeLd8BkwDQYJKoZIhvcNAQEL 3 | BQAwLjELMAkGA1UEBhMCQ0gxEDAOBgNVBAoMB3Rlc3QtY2ExDTALBgNVBAMMBHJv 4 | b3QwHhcNMjMwOTA2MDMzNDI3WhcNMzMwOTAzMDMzNDI3WjAuMQswCQYDVQQGEwJD 5 | SDEQMA4GA1UECgwHdGVzdC1jYTENMAsGA1UEAwwEcm9vdDCCASIwDQYJKoZIhvcN 6 | AQEBBQADggEPADCCAQoCggEBAMjXEshOucs4SFJkJl9GUvWdN5u0mZszwlHSQZUH 7 | LrxRq6Z7QVm++9tDFp68FlQhEms9MTxe/ggPwLY+lpWl3QKQGGazeFSOjD6nlT0r 8 | FmN4G52yryP8F3VOt3APc+NRVNJHMjzyeicxVzCcfzEuII3QZVKh3QVofmhIqJDn 9 | RRYeFcTUOHNQygCoE3alsAv25PKpQN7H/9TefwCkuS37an4ZJm+nskM+CkDwCsai 10 | Hu29C7VL/TspXEtmvat52biZVY/si2vmITXZky1Sfg+FKIrdsnhEsFgTaOamn8iG 11 | tWrSqOdxwdRgUlfXT0I+SXCuG4qWQXWZ7oKK3pSrGc0p4p0CAwEAAaOBnjCBmzAP 12 | BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBQcsh7OkAUiljB9oah4A7hpk+y5VTBp 13 | BgNVHSMEYjBggBQcsh7OkAUiljB9oah4A7hpk+y5VaEypDAwLjELMAkGA1UEBhMC 14 | Q0gxEDAOBgNVBAoMB3Rlc3QtY2ExDTALBgNVBAMMBHJvb3SCFBF4CTN+qR6jI/ca 15 | TDlfmyHi3fAZMA0GCSqGSIb3DQEBCwUAA4IBAQBI+HZE8KlSHDo8Az5+0TZWwKlO 16 | D/aVAh7O7Amhxp0ukM/tOFymdBZ5J5GrlsEmgJCHX2WkGXIH+i8X67Q6VaA0bWN5 17 | 6Wz+cA9XEyK44j2H5lHubbyIuE9qx71s6QW1u/w7YvK+vyd4K4G4jD2IIwNLiCUd 18 | gwuxG2elVxY2qqPLBNqjkWWLZ6N/LfJ4/qJ/hsl7h6g1OzwRZE+6wOZ2Bik8IA/R 19 | k6m+JhBww4FQp6lfroVKshNBmFfY4TiwLHjQ5CtnDdoktsZBvQkK6pVBGtXR5yPf 20 | AA/+vjiwuxueF97h9lUs1eDW2s3zkW1hOHkc/0lhgX6WBmkgDdjz7FEOi3hh 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/selfsigned.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,6D12ED8559E80FA3 4 | 5 | tv9epnwlt4dP6Q5ee0dACOyFA5BTwYTdoMykQRJrKGwfaNeXUXn+sQ/U/oFHp1Wx 6 | O8VZE+z2aHpiFSTw+Eh6MPt86X5yVG3tpeVO6dErvr8Kd+NpuI8zn7rNoOFRh8wD 7 | 33EFcQMLQPneDl10O18hooIoi0qwp1pd63hYZPwEhB3eOrM5Mnv9OVJs65bzYfyf 8 | Wku33YWYxeqlDvMCsou8PZnv/M2wYsr7+QoTcNmGKP45igMthMDBzwgF+q0p9ZZU 9 | N11c6ojAs01kfuqFf3vKfHNYe6zsBiNhnUuEy8enXSxD5E7tR/OI8aEzPLdk7fmN 10 | /UsMK2LE0Yd5iS3O1x/1ZjSBxJ+M/UzzCO692GTAiD6Hc13iJOavq/vt1mEPjfCD 11 | neF38Bhb5DfFi+UAHrz6EHMreamGCzP82us2maIs7mSTq7nXDZfbBc7mBDLAUUnT 12 | J6tlrTyc+DQXzkJa6jmbxJhcsWm6XvjIBEzSXVHxEDPLnZICQk3VXODjCXTD75Rg 13 | 0WaS78Ven7DW8wn07q3VzWAFDKaet3VI+TVTv7EfIavlfiA6LSshaENdFLeHahNE 14 | s/V/j5K3Pg6+WQcZRgOsfqIwUCSQxY13R6TTdaaCkLay5BggF5iiAO3pkqsJiadf 15 | w843Ak4USBptymJxoZgJyFtQHpQyNiFfsAbs9BaYbg2evvE7/VQhLk0gQ7HgQMeJ 16 | wgxEQqZQKDCCSugSzY1YEGXKnrZYCKyipzyyH936mE15zNwhYp/Pi2020+gmtP3h 17 | CDfcPs1yeLI2/1JuimafbuKsv9xchWa6ASU8p8Q7wTLtUj9ylLKyA4A/75pK0DXG 18 | Hv/q0O+UfhAMD438SoPBle7RSvIsDU1VjUqstlNybBglBZxGIME7/18+Ms7U32wh 19 | 4xFkZwxT2nqFgyk37tXMdMz9UBh12/AXR9NU4XY37C3Ao2TDT7/0DvU6KdJhsDpv 20 | rGcaC2zzhko+0CPrLlk52KbqP003JXiWvOSI+FylyPPDB/YGitmndJUuQblf3u/E 21 | l+tGi9MeSBQeWKV6D3AVnO05AZjfTUzSK0vw4DgNh5YPNJvLy31B7kDAS88vyGI1 22 | t6MBwjW4/tz/nS/p1Go3mSzBhPkIsCrZE+ar7lH8p8JqkLl4fXIMaVKIfyfJdzyS 23 | lkh3K7bOGDPegxxxaWdb+EnC7k+1R3EOU7uJFW61HyrGI3q6Y7kOl5aYSJ5Ge1Uv 24 | PycFWHWVTHq/R7HRE6HIJzGe/PnLIbStXLDFeivjfcYq1YaSaF8Vl+xg+0u3ULOl 25 | P6IuPTph6dlcgttRZVl3ETcF0T+2wfbUwgjf0ZiguCJfR2jLGhPl1KBg0Kd9cTSY 26 | zI3YMMd2G8hApt/QFlm4Ry8CqaJUmDcjDNIJT3M+RldUgfz37NsX05cA5e9+I1AL 27 | 2406F/v5U9gWsYx7HuwJtQrDzYYDbl1GD4H+qHFJE5JYhPP4AyWYxJ1NR5dqyvrt 28 | +3r5+xlwZrS76c10RsBWL7th8ZEzRxOZxbtLwbf4bG/tIGfQP2sTnWwA+qym6b2S 29 | sRduqOTP+xwnhOq/ZKn8lfsDfhT8CPnKHBsd09kM9y/UWuxFe0upLydRLE/Wsb9s 30 | -----END RSA PRIVATE KEY----- 31 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/selfsigned.password: -------------------------------------------------------------------------------- 1 | vesoft 2 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/selfsigned.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEGzCCAwOgAwIBAgIUDcmZFpL4PcdCXfLRBK8bR2vb39cwDQYJKoZIhvcNAQEL 3 | BQAwgZwxCzAJBgNVBAYTAkNOMREwDwYDVQQIDAhaaGVqaWFuZzERMA8GA1UEBwwI 4 | SGFuZ3pob3UxFDASBgNVBAoMC1Zlc29mdCBJbmMuMRAwDgYDVQQLDAdzZWN0aW9u 5 | MRYwFAYDVQQDDA1zaHlsb2NrIGh1YW5nMScwJQYJKoZIhvcNAQkBFhhzaHlsb2Nr 6 | Lmh1YW5nQHZlc29mdC5jb20wHhcNMjEwODE5MDkyNDQ3WhcNMjUwODE4MDkyNDQ3 7 | WjCBnDELMAkGA1UEBhMCQ04xETAPBgNVBAgMCFpoZWppYW5nMREwDwYDVQQHDAhI 8 | YW5nemhvdTEUMBIGA1UECgwLVmVzb2Z0IEluYy4xEDAOBgNVBAsMB3NlY3Rpb24x 9 | FjAUBgNVBAMMDXNoeWxvY2sgaHVhbmcxJzAlBgkqhkiG9w0BCQEWGHNoeWxvY2su 10 | aHVhbmdAdmVzb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB 11 | AMEAgpamCQHl+8JnUHI6/VmJHjDLYJLTliN/CwpFrhMqIVjJ8wG57WYLpXpn91Lz 12 | eHu52LkVzcikybIJ2a+LOTvnhNFdbmTbqDtrb+s6wM/sO+nF6tU2Av4e5zhyKoeR 13 | LL+rHMk3nymohbdN4djySFmOOU5A1O/4b0bZz4Ylu995kUawdiaEo13BzxxOC7Ik 14 | Gge5RyDcm0uLXZqTAPy5Sjv/zpOyj0AqL1CJUH7XBN9OMRhVU0ZX9nHWl1vgLRld 15 | J6XT17Y9QbbHhCNEdAmFE5kEFgCvZc+MungUYABlkvoj86TLmC/FMV6fWdxQssyd 16 | hS+ssfJFLaTDaEFz5a/Tr48CAwEAAaNTMFEwHQYDVR0OBBYEFK0GVrQx+wX1GCHy 17 | e+6fl4X+prmYMB8GA1UdIwQYMBaAFK0GVrQx+wX1GCHye+6fl4X+prmYMA8GA1Ud 18 | EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHqP8P+ZUHmngviHLSSN1ln5 19 | Mx4BCkVeFRUaFx0yFXytV/iLXcG2HpFg3A9rAFoYgCDwi1xpsERnBZ/ShTv/eFOc 20 | IxBY5yggx3/lGi8tAgvUdarhd7mQO67UJ0V4YU3hAkbnZ8grHHXj+4hfgUpY4ok6 21 | yaed6HXwknBb9W8N1jZI8ginhkhjaeRCHdMiF+fBvNCtmeR1bCml1Uz7ailrpcaT 22 | Mf84+5VYuFEnaRZYWFNsWNCOBlJ/6/b3V10vMXzMmYHqz3xgAq0M3fVTFTzopnAX 23 | DLSzorL/dYVdqEDCQi5XI9YAlgWN4VeGzJI+glkLOCNzHxRNP6Qev+YI+7Uxz6I= 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDKzCCAhOgAwIBAgIUczXPKik40SjLEw/bFLb8emHV8Q8wDQYJKoZIhvcNAQEL 3 | BQAwLjELMAkGA1UEBhMCQ0gxEDAOBgNVBAoMB3Rlc3QtY2ExDTALBgNVBAMMBHJv 4 | b3QwHhcNMjMwOTA2MDUyNzE1WhcNMjMwOTE2MDUyNzE1WjAwMQswCQYDVQQGEwJD 5 | SDEQMA4GA1UECgwHdGVzdC1jYTEPMA0GA1UEAwwGc2VydmVyMIIBIjANBgkqhkiG 6 | 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2FADBs38uSLTypNJhuHKRfKnxQ3Coj+St0bo 7 | SRSdfiOc7pcgJRLnU+HtBcNnPI1U9JqsCvQ9lelO/vaJQTSW0+ftFsGHGqdnU8Nx 8 | 7Q45gHaTAhXLHqCUYzwdFzVxih96klzpqC3rN4850HSf9MEw2WW3zKKDHngD2jzb 9 | POr0q4n6IG754Hvh95Zs9a4qdkENDv/wehxJ+92Bl7GWT2Pr517AXRwjFC/UDjd8 10 | 7WTIrR+HNLz489NvNwWWtV3XOAfWUyhlKKyqJZ9WIpf/fhqgEqjuFBoD5/G7dyH0 11 | waL9sTnZLlyR7IDvWel8FAmRgVCpg4Ug+czMPmtojlXefyIW7QIDAQABoz8wPTA7 12 | BgNVHREENDAyhwR/AAABhwTAqAjKgglsb2NhbGhvc3SCB2dyYXBoZDCCB2dyYXBo 13 | ZDGCB2dyYXBoZDIwDQYJKoZIhvcNAQELBQADggEBAJ07ST/5kTGNxTYoxJxtxGo/ 14 | OLtUsfuu7apYdUPgpr1ZQB3hGCZ/+C8aGHEzf+a+qLSZsofd8VKXDvdPg+bStlAP 15 | aAbHjnj4uA2Jn2efBZ7EBmocxVuJ6lngbOK6ApCQqynP2jHb1VZHgH+AqZio5ahd 16 | 2GosmcO+4vGf5p6k8de2sS8ryj1EhoLMQMmjPn0hDS/Zy2A7qxlwOZfVzvV6hz0u 17 | CglVGBGA89oAXUmnRclpDvvl9M0Xue3eH0LmzVHNgGHlc/XtM4hvnyyObA7MhnGB 18 | xLiFfUlxp30DQX1I6BAh3QmCDAyeGL8BWI7KP7dR7DjeSnNKQ0wVTtMaH0aouRk= 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /examples/src/main/resources/ssl/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpQIBAAKCAQEA2FADBs38uSLTypNJhuHKRfKnxQ3Coj+St0boSRSdfiOc7pcg 3 | JRLnU+HtBcNnPI1U9JqsCvQ9lelO/vaJQTSW0+ftFsGHGqdnU8Nx7Q45gHaTAhXL 4 | HqCUYzwdFzVxih96klzpqC3rN4850HSf9MEw2WW3zKKDHngD2jzbPOr0q4n6IG75 5 | 4Hvh95Zs9a4qdkENDv/wehxJ+92Bl7GWT2Pr517AXRwjFC/UDjd87WTIrR+HNLz4 6 | 89NvNwWWtV3XOAfWUyhlKKyqJZ9WIpf/fhqgEqjuFBoD5/G7dyH0waL9sTnZLlyR 7 | 7IDvWel8FAmRgVCpg4Ug+czMPmtojlXefyIW7QIDAQABAoIBAQChIFBw1CUo/rFG 8 | FxpQ14VlPxALL2nIk5RE4xOJxEpgOETgUEAIfaFEkWiNv3T53MjofwIiEraBIU3P 9 | i3LH2FV1OTAYoEVz7DiCY3ZMPylD8I8moXcwtCp0FMYSkKOnYDVcKst9k96+/vfw 10 | t76igPlTJnqXeoIywvETsfsY0Gc6EmlKYWILwX7cfkOvnCofbSDjkX5x24jDvK9L 11 | O9aaTmU+BfHA8gpaalF69SFOck1zP0Zu9uFI1hpjuL63lqrGA0INfcENZG5FR4wC 12 | CI69BtXcOVbLb3FK+j1QVjU+IX9Hu1dw7zn1/PwLZHhiLmYyz/B0VC6LzpxB5L5P 13 | 7v2U9U8dAoGBAPEIMbWjrzGBHx3eEwH1lECh1KXRDSo5xwH8DvGedO2+of/nz/Iv 14 | sfOYRJ/xHyFe5Byz0m/7IX/XdcQ4LlGGpv5Z48olZ2YNvppF5mv5O4/KK0w0dlmm 15 | tNvEzwL7pM8xpKk7rm8RKc5aw4vcn7e+9gBTKuhW7o2z6dF2uvBaQj1/AoGBAOW+ 16 | 1w1TeNwKhB/hZhxNRBlTv8MGml3gx3L5s+28L/bJ/IQCpGptmuHgDIFfqOtO0Mzo 17 | SnwNMoYZcqRS29Ms/ygcFvP3nZ6zsNaT3cDnR1UHBc4byaDa8a7INcTDAVDAYBML 18 | 4o51dsguWPAqdN3Od5yuK5C7Qexfzb+y4srXWLmTAoGABJFdL84MUenahxxgS9c1 19 | mgv3FbVihHxX0yfNuLKCEMdeFpV0EWjp/G3UTxuotV8w/4JA6LJfriaNKszNw+nD 20 | XGqjsH8I+JwmEpJkjYNJp63zKByOaaCJKOkP60SNmQed0T86TQyMOEbsEch6lmbe 21 | Dp+E3qZXGwRf2AJiBJARVU0CgYEAwMvuwiMbWGSGzg4j13pLvIlYcjxXTJK2LVk4 22 | 0jdLdOm6O7nP6fRCtmyDcgopwhXpCRuibgnRLVGrsBRMnyGymiFAbcmM/0JCE0AR 23 | JrGvXb4/89/Dy3YQvSEMZitTLkXSGgmuPOh8Hq8uOZUXb4+1Nsm+i31pbAhVrBpd 24 | UeV3cnsCgYEA3nKwC+hjSe5jLJJKD/GEfCcALqWEuX4xJJjXAPPQ5advWdUwQmA8 25 | LnrcJROvDP9nW0hjiCXWifAYC9fbXdmU1e6HTfHIIbsTqHGMA2mZEe+XQevj/GVT 26 | hZ4gALLJzMtbqyJd/53Vs0CRcEeke8YRs0NqGF6La/mjnHbwoKqIpYM= 27 | -----END RSA PRIVATE KEY----- 28 | --------------------------------------------------------------------------------