text:
<?php

namespace PalufTeamBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class PalufTeamBundle extends Bundle
{
}


text:
define([
        'jquery.xml2json',
        'jquery.json',
        'bootstrap',
        'select2',
        'slick.core',
        'slick.dataview',
        //From jquery-libs
        'jquery.timer',
        'jquery.ui.touch-punch',
        'jquery.validate',
        'jquery.tristate',
        'jquery.multiselect',
        'jquery.multiselect.filter',
        'jquery.steps.min',
        'jquery.panzoom',
        'jquery.event.drag',
        'jquery.datetimepicker',
        'slick.grid',
        'slick.checkboxselectcolumn',
        'slick.groupmetadata',
        'slick.rowselectionmodel',
        'd3',
        'nv.d3'
        ],function() {});

redpajama_set_name: RedPajamaGithub


text:
namespace NFOGenerator.Tools.ImageUploader
{
    partial class FrmImageUploader
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.lblImagesToUpload = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // lblImagesToUpload
            //
            this.lblImagesToUpload.AutoSize = true;
            this.lblImagesToUpload.Location = new System.Drawing.Point(13, 13);
            this.lblImagesToUpload.Name = "lblImagesToUpload";
            this.lblImagesToUpload.Size = new System.Drawing.Size(107, 12);
            this.lblImagesToUpload.TabIndex = 0;
            this.lblImagesToUpload.Text = "Images to upload:";
            //
            // FrmImageUploader
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(784, 582);
            this.Controls.Add(this.lblImagesToUpload);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FrmImageUploader";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.Text = "Image Uploader";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label lblImagesToUpload;

    }
}


text:
#!/usr/bin/env python
from setuptools import setup, find_packages
import advanced_reports

setup(
    name="django-advanced-reports",
    version=advanced_reports.__version__,
    url='https://github.com/vikingco/django-advanced-reports',
    license='BSD',
    description="Advanced reports for Django",
    long_description=open('README.rst', 'r').read(),
    author='Jef Geskens, Unleashed NV',
    author_email='operations@unleashed.be',
    packages=find_packages('.'),
    package_data = {'advanced_reports': [
                'static/*.js', 'static/*/*.js', 'static/*/*/*.js',
                'static/*.css', 'static/*/*.css', 'static/*/*/*.css',
                'static/*.png', 'static/*/*.png', 'static/*/*/*.png', 'static/*/*/*/*.png',
                'templates/*.html', 'templates/*/*.html', 'templates/*/*/*.html', 'templates/*/*/*/*.html',
                ],},
    zip_safe=False, # Don't create egg files, Django cannot find templates in egg files.
    include_package_data=True,
    classifiers=[
        'Intended Audience :: Developers',
        'Programming Language :: Python',
        'Operating System :: OS Independent',
        'Environment :: Web Environment',
        'Framework :: Django',
    ],
    install_requires=[
        'Django',
        'six',
        'django-widget-tweaks',
        'pygments',
    ]
)


text:
package kubecli

import (
	k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes/scheme"
	"k8s.io/client-go/rest"

	"k8s.io/apimachinery/pkg/types"

	"kubevirt.io/kubevirt/pkg/api/v1"
)

func (k *kubevirt) VirtualMachine(namespace string) VirtualMachineInterface {
	return &vm{
		restClient: k.restClient,
		namespace:  namespace,
		resource:   "virtualmachines",
	}
}

type vm struct {
	restClient *rest.RESTClient
	namespace  string
	resource   string
}

// Create new VirtualMachine in the cluster to specified namespace
func (o *vm) Create(offlinevm *v1.VirtualMachine) (*v1.VirtualMachine, error) {
	newOvmi := &v1.VirtualMachine{}
	err := o.restClient.Post().
		Resource(o.resource).
		Namespace(o.namespace).
		Body(offlinevm).
		Do().
		Into(newOvmi)

	newOvmi.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind)

	return newOvmi, err
}

// Get the OfflineVirtual machine from the cluster by its name and namespace
func (o *vm) Get(name string, options *k8smetav1.GetOptions) (*v1.VirtualMachine, error) {
	newOvm := &v1.VirtualMachine{}
	err := o.restClient.Get().
		Resource(o.resource).
		Namespace(o.namespace).
		Name(name).
		VersionedParams(options, scheme.ParameterCodec).
		Do().
		Into(newOvm)

	newOvm.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind)

	return newOvm, err
}

// Update the VirtualMachine instance in the cluster in given namespace
func (o *vm) Update(offlinevm *v1.VirtualMachine) (*v1.VirtualMachine, error) {
	updatedOvmi := &v1.VirtualMachine{}
	err := o.restClient.Put().
		Resource(o.resource).
		Namespace(o.namespace).
		Name(offlinevm.Name).
		Body(offlinevm).
		Do().
		Into(updatedOvmi)

	updatedOvmi.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind)

	return updatedOvmi, err
}

// Delete the defined VirtualMachine in the cluster in defined namespace
func (o *vm) Delete(name string, options *k8smetav1.DeleteOptions) error {
	err := o.restClient.Delete().
		Resource(o.resource).
		Namespace(o.namespace).
		Name(name).
		Body(options).
		Do().
		Error()

	return err
}

// List all VirtualMachines in given namespace
func (o *vm) List(options *k8smetav1.ListOptions) (*v1.VirtualMachineList, error) {
	newOvmList := &v1.VirtualMachineList{}
	err := o.restClient.Get().
		Resource(o.resource).
		Namespace(o.namespace).
		VersionedParams(options, scheme.ParameterCodec).
		Do().
		Into(newOvmList)

	for _, vm := range newOvmList.Items {
		vm.SetGroupVersionKind(v1.VirtualMachineGroupVersionKind)
	}

	return newOvmList, err
}

func (v *vm) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VirtualMachine, err error) {
	result = &v1.VirtualMachine{}
	err = v.restClient.Patch(pt).
		Namespace(v.namespace).
		Resource(v.resource).
		SubResource(subresources...).
		Name(name).
		Body(data).
		Do().
		Into(result)
	return result, err
}


text:
<?php

# Error reporting
error_reporting(-1);

# Main settings vars

$path	= str_replace('/js/jquery/tiny_mce/plugins/Archiv', '', dirname(__FILE__));
$folder	= str_replace($_SERVER['DOCUMENT_ROOT'], '', $path);

$s = array(
	# full path to upload files to and show files from
	'upload_path'			=> $path.'/uploads/wysiwyg/',
	# full URI to upload directory
	'upload_uri'			=> 'http://'.$_SERVER['HTTP_HOST'].'/tokita/js/jquery/tiny_mce/plugins/Archiv/uploads/wysiwyg//',
	# Selectable file types, seperated by a ; (* for all) example *.txt;*.doc;*.pdf
	'selectable_files'		=> '*',
	# Selectable image types, seperated by a ; (* for all) example *.gif;*.png;*.jpg
	'selectable_images'		=> '*',
	# Limit of the maximal file size a single file can have (in kB)
	'size_limit'			=> '0',
	# Maximal files that can be uploaded in a single upload run
	'upload_limit'			=> '0',
	# Enables debug mode
	'debug'					=> true,
	# Maximal image width/ height (in px)
	'max_image_size'		=> '600',
	# Maximal image thumb width/ height (in px)
	'max_image_thumb_size'	=> '100',
	# Allowed file mime types
	'allowed_file_mime'		=> array('application/x-javascript',
										'application/json',
										'image/jpg',
										'image/png',
										'image/gif',
										'image/bmp',
										'image/tiff',
										'text/css',
										'application/xml',
										'application/msword',
										'application/vnd.ms-excel',
										'application/vnd.ms-powerpoint',
										'application/rtf',
										'application/pdf',
										'text/html',
										'text/plain',
										'video/mpeg',
										'audio/mpeg3',
										'audio/wav',
										'audio/aiff',
										'video/msvideo',
										'video/x-ms-wmv',
										'video/quicktime',
										'application/zip',
										'application/x-tar',
										'application/x-shockwave-flash'),
	# Allowed image mime types
	'allowed_image_mime'	=> array('image/jpg',
										'image/jpeg',
										'image/png',
										'image/gif'),
	# Language to run the plugin in
	'language'				=> 'en'
);
?>


text:
title: "JSONLOOSE"
layout: "function"
isPage: "true"
link: "/warpscript/functions"
desc: "Generate a loose JSON version (with NaN and Infinite values allowed) of the stack"
categoryTree: ["reference","functions"]
oldPath: ["30-functions","70-platform","10-function_JSONLOOSE.html.md"]
category: "reference"
---

In strict JSON format the [`NaN`]({{ site.baseurl}}/reference/functions/function_NaN) and  `Infinite` values aren't allowed and they are replaced by `null`.

The `JSONLOOSE`function configures the stack to send results in a loose [JSON](http://json.org/) format where
`NaN`and `Infinite` are valid values.

If the JSON parser you're using is strict, you should either configurate the [`JSONSTRICT`]({{ site.baseurl }}/reference/functions/function_JSONSTRICT) mode or dealing with
`NaN`and `Infinite` values outside the parser.

## Warning ##

By default, Warp10 platform  uses the `JSONLOOSE` format.

## Example ##

WarpScript commands:

    JSONLOOSE
    NaN

Stack (in JSON):

    TOP: NaN

{% raw %}
<warp10-warpscript-widget backend="{{backend}}"  exec-endpoint="{{execEndpoint}}">JSONLOOSE
NaN
</warp10-warpscript-widget>
{% endraw %}


text:
package org.apache.geode.internal.cache.tier.sockets;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.quality.Strictness.STRICT_STUBS;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.shiro.subject.Subject;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.InternalCacheForClientAccess;
import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.Command;
import org.apache.geode.internal.cache.tier.CommunicationMode;
import org.apache.geode.internal.cache.tier.Encryptor;
import org.apache.geode.internal.cache.tier.ServerSideHandshake;
import org.apache.geode.internal.cache.tier.sockets.command.PutUserCredentials;
import org.apache.geode.internal.monitoring.ThreadsMonitoring;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.security.AuthenticationFailedException;
import org.apache.geode.security.AuthenticationRequiredException;
import org.apache.geode.test.junit.categories.ClientServerTest;

@Category(ClientServerTest.class)
public class ServerConnectionTest {
  @Rule
  public MockitoRule mockitoRule = MockitoJUnit.rule().strictness(STRICT_STUBS);

  private AcceptorImpl acceptor;
  private Message requestMessage;
  private ServerSideHandshake handshake;
  private SecurityService securityService;

  private ServerConnection serverConnection;
  private Command command;
  private InetAddress inetAddress;
  private Socket socket;
  private InternalCacheForClientAccess cache;
  private CachedRegionHelper cachedRegionHelper;
  private InternalDistributedSystem internalDistributedSystem;
  private DistributionManager distributionManager;
  private ThreadsMonitoring threadsMonitoring;
  private CacheClientNotifier notifier;
  private ClientHealthMonitor clientHealthMonitor;

  @Before
  public void setUp() throws IOException {
    inetAddress = mock(InetAddress.class);
    socket = mock(Socket.class);
    acceptor = mock(AcceptorImpl.class);
    handshake = mock(ServerSideHandshake.class);
    requestMessage = mock(Message.class);
    securityService = mock(SecurityService.class);
    command = mock(Command.class);
    notifier = mock(CacheClientNotifier.class);
    clientHealthMonitor = mock(ClientHealthMonitor.class);

    when(inetAddress.getHostAddress()).thenReturn("localhost");
    when(socket.getInetAddress()).thenReturn(inetAddress);
    cache = mock(InternalCacheForClientAccess.class);
    cachedRegionHelper = mock(CachedRegionHelper.class);
    internalDistributedSystem = mock(InternalDistributedSystem.class);
    distributionManager = mock(DistributionManager.class);
    threadsMonitoring = mock(ThreadsMonitoring.class);

    when(cachedRegionHelper.getCache()).thenReturn(cache);
    when(cache.getInternalDistributedSystem()).thenReturn(internalDistributedSystem);
    when(internalDistributedSystem.getDM()).thenReturn(distributionManager);
    when(distributionManager.getThreadMonitoring()).thenReturn(threadsMonitoring);

    serverConnection =
        new ServerConnection(socket, cache,
            cachedRegionHelper, mock(CacheServerStats.class), 0, 0, null,
            CommunicationMode.PrimaryServerToClient.getModeNumber(), acceptor,
            securityService);

    serverConnection.setHandshake(handshake);
  }

  @Test
  public void whenAuthenticationRequiredExceptionIsThrownItShouldBeCaught() {
    when(acceptor.getClientHealthMonitor()).thenReturn(mock(ClientHealthMonitor.class));
    when(acceptor.isSelector()).thenReturn(true);
    doThrow(new AuthenticationRequiredException("Test"))
        .when(serverConnection.stats).decThreadQueueSize();
    serverConnection.setProcessMessages(true);

    assertThatCode(() -> serverConnection.run()).doesNotThrowAnyException();
  }

  @Test
  public void shouldUseUniqueIdFromMessage() {
    long uniqueIdFromMessage = 23456L;
    MessageIdExtractor messageIdExtractor = mock(MessageIdExtractor.class);
    when(handshake.getEncryptor()).thenReturn(mock(Encryptor.class));
    when(messageIdExtractor.getUniqueIdFromMessage(any(Message.class), any(Encryptor.class),
        anyLong())).thenReturn(uniqueIdFromMessage);
    when(requestMessage.isSecureMode()).thenReturn(true);
    serverConnection.setMessageIdExtractor(messageIdExtractor);
    serverConnection.setRequestMessage(requestMessage);

    long value = serverConnection.getUniqueId();

    assertThat(value).isEqualTo(uniqueIdFromMessage);
  }

  @Test
  public void nonSecureShouldThrow() {
    assertThatThrownBy(() -> serverConnection.getUniqueId())
        .isExactlyInstanceOf(AuthenticationRequiredException.class)
        .hasMessage("No security credentials are provided");
  }

  @Test
  public void bindSubjectDoesNothingIfNotIntegratedService() {
    ServerConnection connection = spy(serverConnection);
    assertThat(securityService.isIntegratedSecurity()).isFalse();
    connection.bindSubject(command);
    verify(connection, never()).getUniqueId();
  }

  @Test
  public void bindSubjectDoesNothingIfWAN() {
    serverConnection =
        new ServerConnection(socket, cache,
            cachedRegionHelper, mock(CacheServerStats.class), 0, 0, null,
            CommunicationMode.GatewayToGateway.getModeNumber(), acceptor,
            securityService);
    ServerConnection connection = spy(serverConnection);
    when(securityService.isIntegratedSecurity()).thenReturn(true);
    connection.bindSubject(command);
    verify(connection, never()).getUniqueId();
  }

  @Test
  public void bindSubjectDoesNothingIfPutUserCredential() {
    ServerConnection connection = spy(serverConnection);
    when(securityService.isIntegratedSecurity()).thenReturn(true);
    command = mock(PutUserCredentials.class);
    connection.bindSubject(command);
    verify(connection, never()).getUniqueId();
  }

  @Test
  public void bindSubjectDoesNothingIfInternalMessage() {
    ServerConnection connection = spy(serverConnection);
    when(securityService.isIntegratedSecurity()).thenReturn(true);
    doReturn(true).when(connection).isInternalMessage(any(Message.class), anyBoolean());
    connection.bindSubject(command);
    verify(connection, never()).getUniqueId();
  }

  @Test
  public void bindSubject() {
    ServerConnection connection = spy(serverConnection);
    initializeClientUserAuth(connection);

    when(acceptor.getCacheClientNotifier()).thenReturn(notifier);
    when(securityService.isIntegratedSecurity()).thenReturn(true);
    doReturn(false).when(connection).isInternalMessage(any(Message.class), anyBoolean());
    doReturn(123L).when(connection).getUniqueId();

    // right now the clientUserAuth contains no such subject
    assertThatThrownBy(() -> connection.bindSubject(command))
        .isInstanceOf(AuthenticationRequiredException.class)
        .hasMessageContaining("Failed to find the authenticated user.");

    // verify bindSubject will be called if we have an existing subject
    Subject subject = mock(Subject.class);
    connection.putSubject(subject, 123L);
    connection.bindSubject(command);
    verify(securityService).bindSubject(subject);
  }

  // this initializes the clientUserAuths
  private void initializeClientUserAuth(ServerConnection connection) {
    doNothing().when(connection).initializeCommands();
    ClientProxyMembershipID proxyId = mock(ClientProxyMembershipID.class);
    InternalDistributedMember member = mock(InternalDistributedMember.class);
    when(proxyId.getDistributedMember()).thenReturn(member);
    connection.setProxyId(proxyId);
    connection.doHandshake();
  }

  @Test
  public void putSubject() {
    ServerConnection connection = spy(serverConnection);
    initializeClientUserAuth(connection);

    when(acceptor.getCacheClientNotifier()).thenReturn(notifier);
    Subject subject = mock(Subject.class);
    CacheClientProxy proxy = mock(CacheClientProxy.class);
    when(notifier.getClientProxy(any(ClientProxyMembershipID.class))).thenReturn(proxy);

    // when proxy begins with null subject
    long userId = connection.putSubject(subject, 123L);
    // if proxy has no subject set, then setSubject won't be called
    assertThat(userId).isEqualTo(123L);
    verify(proxy, never()).setSubject(any());

    // if proxy has existing subject, but the proxy is not waitingForReAuth, subject won't be
    // updated
    when(proxy.getSubject()).thenReturn(subject);
    connection.putSubject(subject, 123L);
    verify(proxy, never()).setSubject(any());

    // if proxy has existing subject, and the proxy is waitingForReAuth, then subject is updated
    when(proxy.isWaitingForReAuthentication()).thenReturn(true);
    connection.putSubject(subject, 123L);
    verify(proxy).setSubject(any());
  }

  @Test
  public void messageNonSecureModeShouldThrowAuthenticationFailedException() {
    when(requestMessage.isSecureMode()).thenReturn(false);
    assertThatThrownBy(() -> serverConnection.setCredentials(requestMessage, -1))
        .isInstanceOf(AuthenticationFailedException.class);
  }

  @Test
  public void getUniqueIdBytesShouldThrowCacheClosedException() throws Exception {
    ServerConnection spy = spy(serverConnection);
    doThrow(new CacheClosedException()).when(spy).getUniqueId(requestMessage, -1);
    assertThatThrownBy(() -> spy.getUniqueIdBytes(requestMessage, -1))
        .isInstanceOf(CacheClosedException.class);
  }

  @Test
  public void doNormalMessageShouldNotProcessMessageWhenTerminated() {
    ServerConnection spy = spy(serverConnection);
    ServerConnectionCollection serverConnections = mock(ServerConnectionCollection.class);
    spy.setServerConnectionCollection(serverConnections);
    when(serverConnections.incrementConnectionsProcessing()).thenReturn(true);

    doReturn(true).when(spy).isTerminated();

    spy.doNormalMessage();
    assertThat(spy.getProcessMessages()).isFalse();
    verify(spy, never()).resumeThreadMonitoring();
  }

  @Test
  public void handleTerminationWithoutUnrgisterClientShouldNotNullClientAuths() {
    when(acceptor.getClientHealthMonitor()).thenReturn(clientHealthMonitor);
    when(acceptor.getCacheClientNotifier()).thenReturn(notifier);
    ClientUserAuths clientUserAuths = mock(ClientUserAuths.class);
    ServerConnection spy = spy(serverConnection);
    doReturn(new HashMap<>()).when(clientHealthMonitor).getCleanupTable();
    doReturn(new HashMap<>()).when(clientHealthMonitor).getCleanupProxyIdTable();
    spy.setClientUserAuths(clientUserAuths);

    spy.handleTermination(false);
    assertThat(spy.getClientUserAuths()).isNotNull();

    // subsequent putSubject call will be successful
    Subject subject = mock(Subject.class);
    spy.putSubject(subject, -1);
  }

  @Test
  public void handleTerminationWithUnregisterClientShouldNullClientAuths() {
    when(acceptor.getClientHealthMonitor()).thenReturn(clientHealthMonitor);
    when(acceptor.getCacheClientNotifier()).thenReturn(notifier);
    when(acceptor.getConnectionListener()).thenReturn(mock(ConnectionListener.class));
    ClientUserAuths clientUserAuths = mock(ClientUserAuths.class);
    ServerConnection spy = spy(serverConnection);
    Map<ServerSideHandshake, MutableInt> cleanupTable = mock(Map.class);
    when(cleanupTable.get(any())).thenReturn(mock(MutableInt.class));
    doReturn(cleanupTable).when(clientHealthMonitor).getCleanupTable();
    doReturn(new HashMap<>()).when(clientHealthMonitor).getCleanupProxyIdTable();
    spy.setClientUserAuths(clientUserAuths);

    ClientProxyMembershipID proxyId = mock(ClientProxyMembershipID.class);
    when(proxyId.isDurable()).thenReturn(true);
    when(proxyId.getDistributedMember()).thenReturn(mock(InternalDistributedMember.class));
    spy.setProxyId(proxyId);

    // this will make handleTermination to unregister the client
    spy.processHandShake();
    spy.handleTermination(false);
    assertThat(spy.getClientUserAuths()).isNull();
  }
}


text:
import React from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import '../common/common.css';

/**
 * Dialog with action buttons. The actions are passed in as an array of React objects,
 * in this example [FlatButtons](/#/components/flat-button).
 *
 * You can also close this dialog by clicking outside the dialog, or with the 'Esc' key.
 */
export default class MyDialog extends React.Component {
  state = {
    open: false,
  };

  handleOpen = () => {
    this.setState({open: true});
  };

  handleClose = () => {
    this.setState({open: false});
  };

  handleNewWindow =() => {
    window.open (this.props.src);
  }

  render() {
    const {primary,secondary,src} = this.props;
    const actions = [
        src?
        <FlatButton
        label="查看该数据结构源代码(JS版)"
        secondary={true}
        onTouchTap={this.handleNewWindow}
      /> : null,
      <FlatButton
        label="太长不看..."
        primary={true}
        onTouchTap={this.handleClose}
      />,
      <FlatButton
        label="了解"
        primary={true}
        keyboardFocused={true}
        onTouchTap={this.handleClose}
      />,
    ];

    return (
      <div style={{display:'inline'} }>
        <RaisedButton label={this.props.label} className='btn'  primary={primary} secondary={secondary} onTouchTap={this.handleOpen} />
        <Dialog
          title={this.props.title}
          actions={actions}
          modal={false}
          open={this.state.open}
          onRequestClose={this.handleClose}
        >
          {this.props.children}
        </Dialog>
      </div>
    );
  }
}


text:
/*
              High Contrast
=============================================
 * Color Schema:
 *     DEFINITIONS:
 *         white     : #ffffff
 *         black     : #000000

 */
.fl-theme-hc :focus,
.fl-theme-hc .selectable  {
   /* themed focus indicator */
   outline: 0.2em solid #F00;
}

.fl-theme-hc {color:#000000 !important; background-color:#ffffff !important;}
.fl-theme-hc div, .fl-theme-hc input {color:#000000; background-color:#ffffff; border-color:#000;}
.fl-theme-hc .fl-knockout {background:transparent !important; color:#000;} /* a granular method for basic reset of appearance */

/* Links */
.fl-theme-hc a  {color: #000 !important; font-weight:bold; background-color:#fff !important;}
.fl-theme-hc a:hover {color: #fff !important; background-color:#000 !important;}
.fl-theme-hc a:hover * {color: #fff !important; background-color:#000 !important;}

/* Headers */
.fl-theme-hc h1,
.fl-theme-hc h2,
.fl-theme-hc h3,
.fl-theme-hc h4,
.fl-theme-hc h5,
.fl-theme-hc h6 {color:#000 !important; background-color:#fff !important; border-color:#000 !important; border-bottom:0.1em dashed #000000 !important;}

/* Tables */
.fl-theme-hc th {border:0.1em solid #000; background-color:#000 !important; color:#fff !important;}
.fl-theme-hc td {border:0.1em solid #000;}
.fl-theme-hc .fl-textfield {}
.fl-theme-hc .fl-textarea {}

/* temp selector to access inline edit input fields (should use a classname but now there is none applied) */
.fl-theme-hc .fl-inlineEdit-edit {background-color:#000 !important; color:#fff !important; border: 0.1em solid #fff; padding:0.1em; margin:-0.1em;}

/* Helper: Tabs */
.fl-theme-hc .fl-tabs {border-bottom-color:#000;}
.fl-theme-hc .fl-tabs li,
.fl-theme-hc .fl-tabs li *  {border-color:#000; border-bottom-color:#000; }
.fl-theme-hc .fl-tabs li    {background-color:#000;}
.fl-theme-hc .fl-tabs li *  {color:#fff !important; font-weight:bold; background-color:#000 !important;text-decoration:none;}

.fl-theme-hc .fl-tabs li:hover,
.fl-theme-hc .fl-tabs li:hover *,
.fl-theme-hc .fl-tabs li a:hover {color:#000 !important; background-color:#fff !important;}

.fl-theme-hc .fl-tabs li.fl-tabs-active,
.fl-theme-hc .fl-tabs li.fl-tabs-active a,
.fl-theme-hc .fl-tabs li.fl-tabs-active a:hover,

.fl-theme-hc .fl-tabs li.fl-activeTab,
.fl-theme-hc .fl-tabs li.fl-activeTab:hover,
.fl-theme-hc .fl-tabs li.fl-activeTab a,
.fl-theme-hc .fl-tabs li.fl-activeTab a:hover {background-color: #fff !important; border-bottom-color:#fff; color:#000 !important;}
.fl-theme-hc .fl-tab-content {background-color:#ffffff; color:#000;}

/* Helper: Menu */
.fl-theme-hc .fl-listmenu {border:1px solid #000; border-bottom-width:2px; background-color:#fff;}
.fl-theme-hc .fl-listmenu li,
.fl-theme-hc .fl-listmenu li a  {font-weight:bold; color:#000000; background-color:#ffffff; border-color:#000000; text-decoration:none;}
.fl-theme-hc .fl-listmenu a:hover {background-color:#ffffff; color:#fff;}
.fl-theme-hc .fl-listmenu .fl-activemenu,
.fl-theme-hc .fl-listmenu .fl-activemenu:hover { background-color: #fff; border-bottom-color:#fff; color:#508cc9;}

/* Helper: Thumbnail Grid */
.fl-theme-hc .fl-grid {}
.fl-theme-hc .fl-grid li {}
.fl-theme-hc .fl-grid .caption {}

/* Helper: buttons */
.fl-theme-hc .fl-button-right,
.fl-theme-hc .fl-button-left,
.fl-theme-hc .fl-button-inner {padding:0;}

/* Widget core */
.fl-theme-hc .fl-widget {background-color:#000; border:1px solid #fff;}
.fl-theme-hc .fl-widget ul {}
.fl-theme-hc .fl-widget h2 {color:#fff;}
.fl-theme-hc .fl-widget a {color:#000;}
.fl-theme-hc .fl-widget .fl-icon {color:#000; background-image:none; background-color:#fff; text-indent:0; width:auto; height:auto; margin-left:0px; padding:0 2px; display:inline; font-weight:bold;}

/* Widget titlebar */
.fl-theme-hc .fl-widget .fl-widget-titlebar {margin-bottom:3px;}

/* Widget options */
.fl-theme-hc .fl-widget .fl-widget-options {padding:0px;}
.fl-theme-hc .fl-widget .fl-widget-options ul {}
.fl-theme-hc .fl-widget .fl-widget-options li {border-left:1px solid #fff;}
.fl-theme-hc .fl-widget .fl-widget-options a {color:#fff;}
.fl-theme-hc .fl-widget .fl-widget-options .icon {}
.fl-theme-hc .fl-widget .fl-widget-options .viewOptions {}
.fl-theme-hc .fl-widget .fl-widget-options .toggle {}

/* Widget content */
.fl-theme-hc .fl-widget .fl-widget-content {background-color:#fff;}

/* Component: Progressor */
.fl-theme-hc .fl-progress-bounds {border-color:#000; background-color:#fff;}
.fl-theme-hc .fl-progress-fill {color:#fff; background-color:#000;}

/* Component: Uploader */

/* States */
.fl-theme-hc .fl-reorderer-dropMarker {background-color:#f00 !important;}


text:
package bundlepricing.data

/** a named id+price pair */
case class Item(id: String, price: Dollars) {
  override def toString: String = s"$id @ $price"
}


text:
package com.twolinessoftware.smarterlist.activity;

import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v4.view.ViewCompat;

import com.squareup.picasso.Picasso;
import com.twolinessoftware.smarterlist.fragment.SmartItemListViewRecyclerViewFragment;
import com.twolinessoftware.smarterlist.model.SmartList;
import com.twolinessoftware.smarterlist.util.Ln;
import com.twolinessoftware.smarterlist.view.SmartListItemRecyclerViewAdapter;

import java.io.IOException;

public class ShoppingNavigationActivity extends BaseNavigationActivity {

    public static final String EXTRA_SMART_LIST = "EXTRA_SMART_LIST";
    public static final String IMAGE_TRANSITION_NAME = "image_transition_name";

    private SmartList m_smartList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        updateView(getIntent());

        ViewCompat.setTransitionName(getToolbar(),IMAGE_TRANSITION_NAME);

    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        updateView(intent);
    }

    private void updateView(Intent intent) {

        if(intent == null || !intent.hasExtra(EXTRA_SMART_LIST)) {
            Ln.e("Missing SmartList Id");
            finish();
        }

        m_smartList = intent.getParcelableExtra(EXTRA_SMART_LIST);

        setTitle(m_smartList.getName());

        showFragment(SmartItemListViewRecyclerViewFragment.newInstance(m_smartList, SmartListItemRecyclerViewAdapter.SelectionMode.Check));
    }

    private void loadLogoIntoToolbar() {
        BitmapDrawable drawable = null;
        try {
            drawable = new BitmapDrawable(getResources(), Picasso.with(this).load(m_smartList.getIconUrl()).get());
            getToolbar().setLogo(drawable);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}


text:
struct proto_cap {
    const char  *pc_id;
    const char  *pc_description;
};

struct rtpp_command;

void handle_ver_feature(struct cfg *cf, struct rtpp_command *cmd);
struct proto_cap *iterate_proto_caps(struct proto_cap *prevp);


text:
import emptyFunction from "./emptyFunction.js";
import nativeRequestAnimationFrame from "./nativeRequestAnimationFrame.js";

var lastTime = 0;

var requestAnimationFrame =
	nativeRequestAnimationFrame ||
	function(callback) {
		var currTime = Date.now();
		var timeDelay = Math.max(0, 16 - (currTime - lastTime));
		lastTime = currTime + timeDelay;
		return global.setTimeout(function() {
			callback(Date.now());
		}, timeDelay);
	};

requestAnimationFrame(emptyFunction);

export default requestAnimationFrame;


text:
'use strict'

const http = require('http')
const https = require('https')
const dns = require('dns')

const warnings = require('./warnings')
const { kState, kOptions, kServerBindings } = require('./symbols')
const { FST_ERR_HTTP2_INVALID_VERSION, FST_ERR_REOPENED_CLOSE_SERVER, FST_ERR_REOPENED_SERVER } = require('./errors')

module.exports = createServer

function createServer (options, httpHandler) {
  const server = getServerInstance(options, httpHandler)

  return { server, listen }

  // `this` is the Fastify object
  function listen (listenOptions, ...args) {
    let cb = args.slice(-1).pop()
    // When the variadic signature deprecation is complete, the function
    // declaration should become:
    //   function listen (listenOptions = { port: 0, host: 'localhost' }, cb = undefined)
    // Upon doing so, the `normalizeListenArgs` function is no longer needed,
    // and all of this preamble to feed it correctly also no longer needed.
    const firstArgType = Object.prototype.toString.call(arguments[0])
    if (arguments.length === 0) {
      listenOptions = normalizeListenArgs([])
    } else if (arguments.length > 0 && (firstArgType !== '[object Object]' && firstArgType !== '[object Function]')) {
      warnings.emit('FSTDEP011')
      listenOptions = normalizeListenArgs(Array.from(arguments))
      cb = listenOptions.cb
    } else if (args.length > 1) {
      // `.listen(obj, a, ..., n, callback )`
      warnings.emit('FSTDEP011')
      // Deal with `.listen(port, host, backlog, [cb])`
      const hostPath = listenOptions.path ? [listenOptions.path] : [listenOptions.port ?? 0, listenOptions.host ?? 'localhost']
      Object.assign(listenOptions, normalizeListenArgs([...hostPath, ...args]))
    } else {
      listenOptions.cb = cb
    }

    const { host = 'localhost' } = listenOptions
    if (Object.prototype.hasOwnProperty.call(listenOptions, 'host') === false) {
      listenOptions.host = host
    }

    if (host === 'localhost') {
      listenOptions.cb = (err, address) => {
        if (err) {
          // the server did not start
          cb(err, address)
          return
        }

        multipleBindings.call(this, server, httpHandler, options, listenOptions, () => {
          this[kState].listening = true
          cb(null, address)
        })
      }
    }

    // https://github.com/nodejs/node/issues/9390
    // If listening to 'localhost', listen to both 127.0.0.1 or ::1 if they are available.
    // If listening to 127.0.0.1, only listen to 127.0.0.1.
    // If listening to ::1, only listen to ::1.

    if (cb === undefined) {
      const listening = listenPromise.call(this, server, listenOptions)
      /* istanbul ignore else */
      if (host === 'localhost') {
        return listening.then(address => {
          return new Promise((resolve, reject) => {
            multipleBindings.call(this, server, httpHandler, options, listenOptions, () => {
              this[kState].listening = true
              resolve(address)
            })
          })
        })
      }
      return listening
    }

    this.ready(listenCallback.call(this, server, listenOptions))
  }
}

function multipleBindings (mainServer, httpHandler, serverOpts, listenOptions, onListen) {
  // the main server is started, we need to start the secondary servers
  this[kState].listening = false

  // let's check if we need to bind additional addresses
  dns.lookup(listenOptions.host, { all: true }, (dnsErr, addresses) => {
    if (dnsErr) {
      // not blocking the main server listening
      // this.log.warn('dns.lookup error:', dnsErr)
      onListen()
      return
    }

    let binding = 0
    let binded = 0
    const primaryAddress = mainServer.address()
    for (const adr of addresses) {
      if (adr.address !== primaryAddress.address) {
        binding++
        const secondaryOpts = Object.assign({}, listenOptions, {
          host: adr.address,
          port: primaryAddress.port,
          cb: (_ignoreErr) => {
            binded++

            if (!_ignoreErr) {
              this[kServerBindings].push(secondaryServer)
            }

            if (binded === binding) {
              // regardless of the error, we are done
              onListen()
            }
          }
        })

        const secondaryServer = getServerInstance(serverOpts, httpHandler)
        const closeSecondary = () => { secondaryServer.close(() => {}) }
        mainServer.on('unref', closeSecondary)
        mainServer.on('close', closeSecondary)
        mainServer.on('error', closeSecondary)
        listenCallback.call(this, secondaryServer, secondaryOpts)()
      }
    }

    // no extra bindings are necessary
    if (binding === 0) {
      onListen()
      return
    }

    // in test files we are using unref so we need to propagate the unref event
    // to the secondary servers. It is valid only when the user is
    // listening on localhost
    const originUnref = mainServer.unref
    /* istanbul ignore next */
    mainServer.unref = function () {
      originUnref.call(mainServer)
      mainServer.emit('unref')
    }
  })
}

function listenCallback (server, listenOptions) {
  const wrap = (err) => {
    server.removeListener('error', wrap)
    if (!err) {
      const address = logServerAddress.call(this, server)
      listenOptions.cb(null, address)
    } else {
      this[kState].listening = false
      listenOptions.cb(err, null)
    }
  }

  return (err) => {
    if (err != null) return listenOptions.cb(err)

    if (this[kState].listening && this[kState].closing) {
      return listenOptions.cb(new FST_ERR_REOPENED_CLOSE_SERVER(), null)
    } else if (this[kState].listening) {
      return listenOptions.cb(new FST_ERR_REOPENED_SERVER(), null)
    }

    server.once('error', wrap)
    server.listen(listenOptions, wrap)

    this[kState].listening = true
  }
}

function listenPromise (server, listenOptions) {
  if (this[kState].listening && this[kState].closing) {
    return Promise.reject(new FST_ERR_REOPENED_CLOSE_SERVER())
  } else if (this[kState].listening) {
    return Promise.reject(new FST_ERR_REOPENED_SERVER())
  }

  return this.ready().then(() => {
    let errEventHandler
    const errEvent = new Promise((resolve, reject) => {
      errEventHandler = (err) => {
        this[kState].listening = false
        reject(err)
      }
      server.once('error', errEventHandler)
    })
    const listen = new Promise((resolve, reject) => {
      server.listen(listenOptions, () => {
        server.removeListener('error', errEventHandler)
        resolve(logServerAddress.call(this, server))
      })
      // we set it afterwards because listen can throw
      this[kState].listening = true
    })

    return Promise.race([
      errEvent, // e.g invalid port range error is always emitted before the server listening
      listen
    ])
  })
}

function getServerInstance (options, httpHandler) {
  let server = null
  if (options.serverFactory) {
    server = options.serverFactory(httpHandler, options)
  } else if (options.http2) {
    if (options.https) {
      server = http2().createSecureServer(options.https, httpHandler)
    } else {
      server = http2().createServer(httpHandler)
    }
    server.on('session', sessionTimeout(options.http2SessionTimeout))
  } else {
    // this is http1
    if (options.https) {
      server = https.createServer(options.https, httpHandler)
    } else {
      server = http.createServer(httpHandler)
    }
    server.keepAliveTimeout = options.keepAliveTimeout
    server.requestTimeout = options.requestTimeout
    // we treat zero as null
    // and null is the default setting from nodejs
    // so we do not pass the option to server
    if (options.maxRequestsPerSocket > 0) {
      server.maxRequestsPerSocket = options.maxRequestsPerSocket
    }
  }

  if (!options.serverFactory) {
    server.setTimeout(options.connectionTimeout)
  }
  return server
}

function normalizeListenArgs (args) {
  if (args.length === 0) {
    return { port: 0, host: 'localhost' }
  }

  const cb = typeof args[args.length - 1] === 'function' ? args.pop() : undefined
  const options = { cb }

  const firstArg = args[0]
  const argsLength = args.length
  const lastArg = args[argsLength - 1]
  if (typeof firstArg === 'string' && isNaN(firstArg)) {
    /* Deal with listen (pipe[, backlog]) */
    options.path = firstArg
    options.backlog = argsLength > 1 ? lastArg : undefined
  } else {
    /* Deal with listen ([port[, host[, backlog]]]) */
    options.port = argsLength >= 1 && Number.isInteger(firstArg) ? firstArg : 0
    // This will listen to what localhost is.
    // It can be 127.0.0.1 or ::1, depending on the operating system.
    // Fixes https://github.com/fastify/fastify/issues/1022.
    options.host = argsLength >= 2 && args[1] ? args[1] : 'localhost'
    options.backlog = argsLength >= 3 ? args[2] : undefined
  }

  return options
}

function logServerAddress (server) {
  let address = server.address()
  const isUnixSocket = typeof address === 'string'
  /* istanbul ignore next */
  if (!isUnixSocket) {
    if (address.address.indexOf(':') === -1) {
      address = address.address + ':' + address.port
    } else {
      address = '[' + address.address + ']:' + address.port
    }
  }
  /* istanbul ignore next */
  address = (isUnixSocket ? '' : ('http' + (this[kOptions].https ? 's' : '') + '://')) + address

  this.log.info('Server listening at ' + address)
  return address
}

function http2 () {
  try {
    return require('http2')
  } catch (err) {
    throw new FST_ERR_HTTP2_INVALID_VERSION()
  }
}

function sessionTimeout (timeout) {
  return function (session) {
    session.setTimeout(timeout, close)
  }
}

function close () {
  this.close()
}


text:
package io.debezium.server;

import java.time.Duration;

import javax.enterprise.event.Observes;
import javax.inject.Inject;

import org.assertj.core.api.Assertions;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;

import io.debezium.server.events.ConnectorCompletedEvent;
import io.debezium.server.events.ConnectorStartedEvent;
import io.debezium.testing.testcontainers.PostgresTestResourceLifecycleManager;
import io.debezium.util.Testing;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;

/**
 * Integration test that verifies basic reading from PostgreSQL database.
 *
 * @author Oren Elias
 */
@QuarkusTest
@TestProfile(DebeziumServerFileConfigProviderProfile.class)
@QuarkusTestResource(PostgresTestResourceLifecycleManager.class)
@EnabledIfSystemProperty(named = "test.apicurio", matches = "false", disabledReason = "DebeziumServerConfigProvidersIT doesn't run with apicurio profile.")
@DisabledIfSystemProperty(named = "debezium.format.key", matches = "protobuf")
@DisabledIfSystemProperty(named = "debezium.format.value", matches = "protobuf")
public class DebeziumServerConfigProvidersIT {

    private static final int MESSAGE_COUNT = 4;
    @Inject
    DebeziumServer server;

    {
        Testing.Files.delete(TestConfigSource.OFFSET_STORE_PATH);
    }

    void setupDependencies(@Observes ConnectorStartedEvent event) {
        if (!TestConfigSource.isItTest()) {
            return;
        }

    }

    void connectorCompleted(@Observes ConnectorCompletedEvent event) throws Exception {
        if (!event.isSuccess()) {
            throw (Exception) event.getError().get();
        }
    }

    @Test
    public void testPostgresWithJson() throws Exception {
        Testing.Print.enable();
        final TestConsumer testConsumer = (TestConsumer) server.getConsumer();
        Awaitility.await().atMost(Duration.ofSeconds(TestConfigSource.waitForSeconds()))
                .until(() -> (testConsumer.getValues().size() >= MESSAGE_COUNT));
        Assertions.assertThat(testConsumer.getValues().size()).isEqualTo(MESSAGE_COUNT);
        Assertions.assertThat(((String) testConsumer.getValues().get(MESSAGE_COUNT - 1))).contains(
                "\"after\":{\"id\":1004,\"first_name\":\"Anne\",\"last_name\":\"Kretchmar\",\"email\":\"annek@noanswer.org\"}");
    }
}


text:
using System;
using System.Linq;
using Bytes2you.Validation.Helpers;

namespace Bytes2you.Validation.ValidationPredicates.FloatPredicates
{
    internal class FloatNotNaNValidationPredicate : ValidationPredicate<float>
    {
        private static readonly PortableLazy<FloatNotNaNValidationPredicate> lazyInstance;

        static FloatNotNaNValidationPredicate()
        {
            lazyInstance = new PortableLazy<FloatNotNaNValidationPredicate>(() => new FloatNotNaNValidationPredicate());
        }

        private FloatNotNaNValidationPredicate()
        {
        }

        public static FloatNotNaNValidationPredicate Instance
        {
            get
            {
                return lazyInstance.Value;
            }
        }

        public override ValidationType ValidationType
        {
            get
            {
                return ValidationType.Default;
            }
        }

        protected override bool IsMatch(float value)
        {
            return !float.IsNaN(value);
        }

        protected override string GetMatchMessage(float value)
        {
            return MessageFormatHelper.Format(ValidationPredicateMessages.NotNaNMessage, value);
        }

        protected override string GetUnmatchMessage(float value)
        {
            return ValidationPredicateMessages.NaNMessage;
        }
    }
}


text:
/// <reference path="../../_references.ts" />

module MvcAngularClientApp {
    "use strict";

    export class MyService {

        public static $inject = [
            "$http"
        ];

        constructor(private $http: ng.IHttpService)
        {

            this.activate();
        }

        activate(): void {

        }

        getIdentity(): ng.IHttpPromise<string> {

            return this.$http<string>({
                url: BASE_API_URL + "identity",
                method: "get",
                data: null
            });
        };

    }

    angular.module(NG_MODULE_NAME).service("MyService", MyService);
}


text:
body {
  background: "string";
  background: "unit";
  background: "unit";
  background: "hsla";
  background: "rgba";
  background: "ident";
  background: "unit";
  background: "function";
  background: "ident";
}


text:
/**
* Connected Vision - https://github.com/ConnectedVision
* MIT License
*/

// auto-generated header by CodeFromTemplate - Connected Vision - https://github.com/ConnectedVision
// CodeFromTemplate Version: 0.3 alpha
// stubs/Store_Manager_SQLite_PinDescription_Default.h
// NEVER TOUCH this file!

#ifndef Store_Manager_SQLite_PinDescription_default
#define Store_Manager_SQLite_PinDescription_default

// --> Do NOT EDIT <--
namespace ConnectedVision {
namespace DataHandling {

#ifndef Store_Manager_SQLite_PinDescription_extended
/**
 * SQLite store manager for: Store_SQLite_PinDescription
 */
typedef Store_Manager_SQLite_Stub_PinDescription Store_Manager_SQLite_PinDescription;
#endif // Store_Manager_SQLite_PinDescription_extended

} // namespace DataHandling
} // namespace ConnectedVision

#endif // Store_Manager_SQLite_PinDescription_default


text:
#ifndef STORAGE_ROCKSDB_INCLUDE_C_H_
#define STORAGE_ROCKSDB_INCLUDE_C_H_

#pragma once

#ifdef _WIN32
#ifdef ROCKSDB_DLL
#ifdef ROCKSDB_LIBRARY_EXPORTS
#define ROCKSDB_LIBRARY_API __declspec(dllexport)
#else
#define ROCKSDB_LIBRARY_API __declspec(dllimport)
#endif
#else
#define ROCKSDB_LIBRARY_API
#endif
#else
#define ROCKSDB_LIBRARY_API
#endif

#ifdef __cplusplus
extern "C" {
#endif

#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

/* Exported types */

typedef struct rocksdb_t                 rocksdb_t;
typedef struct rocksdb_backup_engine_t   rocksdb_backup_engine_t;
typedef struct rocksdb_backup_engine_info_t   rocksdb_backup_engine_info_t;
typedef struct rocksdb_restore_options_t rocksdb_restore_options_t;
typedef struct rocksdb_cache_t           rocksdb_cache_t;
typedef struct rocksdb_compactionfilter_t rocksdb_compactionfilter_t;
typedef struct rocksdb_compactionfiltercontext_t
    rocksdb_compactionfiltercontext_t;
typedef struct rocksdb_compactionfilterfactory_t
    rocksdb_compactionfilterfactory_t;
typedef struct rocksdb_comparator_t      rocksdb_comparator_t;
typedef struct rocksdb_env_t             rocksdb_env_t;
typedef struct rocksdb_fifo_compaction_options_t rocksdb_fifo_compaction_options_t;
typedef struct rocksdb_filelock_t        rocksdb_filelock_t;
typedef struct rocksdb_filterpolicy_t    rocksdb_filterpolicy_t;
typedef struct rocksdb_flushoptions_t    rocksdb_flushoptions_t;
typedef struct rocksdb_iterator_t        rocksdb_iterator_t;
typedef struct rocksdb_logger_t          rocksdb_logger_t;
typedef struct rocksdb_mergeoperator_t   rocksdb_mergeoperator_t;
typedef struct rocksdb_options_t         rocksdb_options_t;
typedef struct rocksdb_block_based_table_options_t
    rocksdb_block_based_table_options_t;
typedef struct rocksdb_cuckoo_table_options_t
    rocksdb_cuckoo_table_options_t;
typedef struct rocksdb_randomfile_t      rocksdb_randomfile_t;
typedef struct rocksdb_readoptions_t     rocksdb_readoptions_t;
typedef struct rocksdb_seqfile_t         rocksdb_seqfile_t;
typedef struct rocksdb_slicetransform_t  rocksdb_slicetransform_t;
typedef struct rocksdb_snapshot_t        rocksdb_snapshot_t;
typedef struct rocksdb_writablefile_t    rocksdb_writablefile_t;
typedef struct rocksdb_writebatch_t      rocksdb_writebatch_t;
typedef struct rocksdb_writeoptions_t    rocksdb_writeoptions_t;
typedef struct rocksdb_universal_compaction_options_t rocksdb_universal_compaction_options_t;
typedef struct rocksdb_livefiles_t     rocksdb_livefiles_t;
typedef struct rocksdb_column_family_handle_t rocksdb_column_family_handle_t;

/* DB operations */

extern ROCKSDB_LIBRARY_API rocksdb_t* rocksdb_open(
    const rocksdb_options_t* options, const char* name, char** errptr);

extern ROCKSDB_LIBRARY_API rocksdb_t* rocksdb_open_for_read_only(
    const rocksdb_options_t* options, const char* name,
    unsigned char error_if_log_file_exist, char** errptr);

extern ROCKSDB_LIBRARY_API rocksdb_backup_engine_t* rocksdb_backup_engine_open(
    const rocksdb_options_t* options, const char* path, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_create_new_backup(
    rocksdb_backup_engine_t* be, rocksdb_t* db, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_purge_old_backups(
    rocksdb_backup_engine_t* be, uint32_t num_backups_to_keep, char** errptr);

extern ROCKSDB_LIBRARY_API rocksdb_restore_options_t*
rocksdb_restore_options_create();
extern ROCKSDB_LIBRARY_API void rocksdb_restore_options_destroy(
    rocksdb_restore_options_t* opt);
extern ROCKSDB_LIBRARY_API void rocksdb_restore_options_set_keep_log_files(
    rocksdb_restore_options_t* opt, int v);

extern ROCKSDB_LIBRARY_API void
rocksdb_backup_engine_restore_db_from_latest_backup(
    rocksdb_backup_engine_t* be, const char* db_dir, const char* wal_dir,
    const rocksdb_restore_options_t* restore_options, char** errptr);

extern ROCKSDB_LIBRARY_API const rocksdb_backup_engine_info_t*
rocksdb_backup_engine_get_backup_info(rocksdb_backup_engine_t* be);

extern ROCKSDB_LIBRARY_API int rocksdb_backup_engine_info_count(
    const rocksdb_backup_engine_info_t* info);

extern ROCKSDB_LIBRARY_API int64_t
rocksdb_backup_engine_info_timestamp(const rocksdb_backup_engine_info_t* info,
                                     int index);

extern ROCKSDB_LIBRARY_API uint32_t
rocksdb_backup_engine_info_backup_id(const rocksdb_backup_engine_info_t* info,
                                     int index);

extern ROCKSDB_LIBRARY_API uint64_t
rocksdb_backup_engine_info_size(const rocksdb_backup_engine_info_t* info,
                                int index);

extern ROCKSDB_LIBRARY_API uint32_t rocksdb_backup_engine_info_number_files(
    const rocksdb_backup_engine_info_t* info, int index);

extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_info_destroy(
    const rocksdb_backup_engine_info_t* info);

extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_close(
    rocksdb_backup_engine_t* be);

extern ROCKSDB_LIBRARY_API rocksdb_t* rocksdb_open_column_families(
    const rocksdb_options_t* options, const char* name, int num_column_families,
    const char** column_family_names,
    const rocksdb_options_t** column_family_options,
    rocksdb_column_family_handle_t** column_family_handles, char** errptr);

extern ROCKSDB_LIBRARY_API rocksdb_t*
rocksdb_open_for_read_only_column_families(
    const rocksdb_options_t* options, const char* name, int num_column_families,
    const char** column_family_names,
    const rocksdb_options_t** column_family_options,
    rocksdb_column_family_handle_t** column_family_handles,
    unsigned char error_if_log_file_exist, char** errptr);

extern ROCKSDB_LIBRARY_API char** rocksdb_list_column_families(
    const rocksdb_options_t* options, const char* name, size_t* lencf,
    char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_list_column_families_destroy(
    char** list, size_t len);

extern ROCKSDB_LIBRARY_API rocksdb_column_family_handle_t*
rocksdb_create_column_family(rocksdb_t* db,
                             const rocksdb_options_t* column_family_options,
                             const char* column_family_name, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_drop_column_family(
    rocksdb_t* db, rocksdb_column_family_handle_t* handle, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_column_family_handle_destroy(
    rocksdb_column_family_handle_t*);

extern ROCKSDB_LIBRARY_API void rocksdb_close(rocksdb_t* db);

extern ROCKSDB_LIBRARY_API void rocksdb_put(
    rocksdb_t* db, const rocksdb_writeoptions_t* options, const char* key,
    size_t keylen, const char* val, size_t vallen, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_put_cf(
    rocksdb_t* db, const rocksdb_writeoptions_t* options,
    rocksdb_column_family_handle_t* column_family, const char* key,
    size_t keylen, const char* val, size_t vallen, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_delete(
    rocksdb_t* db, const rocksdb_writeoptions_t* options, const char* key,
    size_t keylen, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_delete_cf(
    rocksdb_t* db, const rocksdb_writeoptions_t* options,
    rocksdb_column_family_handle_t* column_family, const char* key,
    size_t keylen, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_merge(
    rocksdb_t* db, const rocksdb_writeoptions_t* options, const char* key,
    size_t keylen, const char* val, size_t vallen, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_merge_cf(
    rocksdb_t* db, const rocksdb_writeoptions_t* options,
    rocksdb_column_family_handle_t* column_family, const char* key,
    size_t keylen, const char* val, size_t vallen, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_write(
    rocksdb_t* db, const rocksdb_writeoptions_t* options,
    rocksdb_writebatch_t* batch, char** errptr);

/* Returns NULL if not found.  A malloc()ed array otherwise.
   Stores the length of the array in *vallen. */
extern ROCKSDB_LIBRARY_API char* rocksdb_get(
    rocksdb_t* db, const rocksdb_readoptions_t* options, const char* key,
    size_t keylen, size_t* vallen, char** errptr);

extern ROCKSDB_LIBRARY_API char* rocksdb_get_cf(
    rocksdb_t* db, const rocksdb_readoptions_t* options,
    rocksdb_column_family_handle_t* column_family, const char* key,
    size_t keylen, size_t* vallen, char** errptr);

// if values_list[i] == NULL and errs[i] == NULL,
// then we got status.IsNotFound(), which we will not return.
// all errors except status status.ok() and status.IsNotFound() are returned.
//
// errs, values_list and values_list_sizes must be num_keys in length,
// allocated by the caller.
// errs is a list of strings as opposed to the conventional one error,
// where errs[i] is the status for retrieval of keys_list[i].
// each non-NULL errs entry is a malloc()ed, null terminated string.
// each non-NULL values_list entry is a malloc()ed array, with
// the length for each stored in values_list_sizes[i].
extern ROCKSDB_LIBRARY_API void rocksdb_multi_get(
    rocksdb_t* db, const rocksdb_readoptions_t* options, size_t num_keys,
    const char* const* keys_list, const size_t* keys_list_sizes,
    char** values_list, size_t* values_list_sizes, char** errs);

extern ROCKSDB_LIBRARY_API void rocksdb_multi_get_cf(
    rocksdb_t* db, const rocksdb_readoptions_t* options,
    const rocksdb_column_family_handle_t* const* column_families,
    size_t num_keys, const char* const* keys_list,
    const size_t* keys_list_sizes, char** values_list,
    size_t* values_list_sizes, char** errs);

extern ROCKSDB_LIBRARY_API rocksdb_iterator_t* rocksdb_create_iterator(
    rocksdb_t* db, const rocksdb_readoptions_t* options);

extern ROCKSDB_LIBRARY_API rocksdb_iterator_t* rocksdb_create_iterator_cf(
    rocksdb_t* db, const rocksdb_readoptions_t* options,
    rocksdb_column_family_handle_t* column_family);

extern ROCKSDB_LIBRARY_API void rocksdb_create_iterators(
    rocksdb_t *db, rocksdb_readoptions_t* opts,
    rocksdb_column_family_handle_t** column_families,
    rocksdb_iterator_t** iterators, size_t size, char** errptr);

extern ROCKSDB_LIBRARY_API const rocksdb_snapshot_t* rocksdb_create_snapshot(
    rocksdb_t* db);

extern ROCKSDB_LIBRARY_API void rocksdb_release_snapshot(
    rocksdb_t* db, const rocksdb_snapshot_t* snapshot);

/* Returns NULL if property name is unknown.
   Else returns a pointer to a malloc()-ed null-terminated value. */
extern ROCKSDB_LIBRARY_API char* rocksdb_property_value(rocksdb_t* db,
                                                        const char* propname);

extern ROCKSDB_LIBRARY_API char* rocksdb_property_value_cf(
    rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
    const char* propname);

extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes(
    rocksdb_t* db, int num_ranges, const char* const* range_start_key,
    const size_t* range_start_key_len, const char* const* range_limit_key,
    const size_t* range_limit_key_len, uint64_t* sizes);

extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf(
    rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
    int num_ranges, const char* const* range_start_key,
    const size_t* range_start_key_len, const char* const* range_limit_key,
    const size_t* range_limit_key_len, uint64_t* sizes);

extern ROCKSDB_LIBRARY_API void rocksdb_compact_range(rocksdb_t* db,
                                                      const char* start_key,
                                                      size_t start_key_len,
                                                      const char* limit_key,
                                                      size_t limit_key_len);

extern ROCKSDB_LIBRARY_API void rocksdb_compact_range_cf(
    rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
    const char* start_key, size_t start_key_len, const char* limit_key,
    size_t limit_key_len);

extern ROCKSDB_LIBRARY_API void rocksdb_delete_file(rocksdb_t* db,
                                                    const char* name);

extern ROCKSDB_LIBRARY_API const rocksdb_livefiles_t* rocksdb_livefiles(
    rocksdb_t* db);

extern ROCKSDB_LIBRARY_API void rocksdb_flush(
    rocksdb_t* db, const rocksdb_flushoptions_t* options, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_disable_file_deletions(rocksdb_t* db,
                                                               char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_enable_file_deletions(
    rocksdb_t* db, unsigned char force, char** errptr);

/* Management operations */

extern ROCKSDB_LIBRARY_API void rocksdb_destroy_db(
    const rocksdb_options_t* options, const char* name, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_repair_db(
    const rocksdb_options_t* options, const char* name, char** errptr);

/* Iterator */

extern ROCKSDB_LIBRARY_API void rocksdb_iter_destroy(rocksdb_iterator_t*);
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_iter_valid(
    const rocksdb_iterator_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_iter_seek_to_first(rocksdb_iterator_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_iter_seek_to_last(rocksdb_iterator_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_iter_seek(rocksdb_iterator_t*,
                                                  const char* k, size_t klen);
extern ROCKSDB_LIBRARY_API void rocksdb_iter_next(rocksdb_iterator_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_iter_prev(rocksdb_iterator_t*);
extern ROCKSDB_LIBRARY_API const char* rocksdb_iter_key(
    const rocksdb_iterator_t*, size_t* klen);
extern ROCKSDB_LIBRARY_API const char* rocksdb_iter_value(
    const rocksdb_iterator_t*, size_t* vlen);
extern ROCKSDB_LIBRARY_API void rocksdb_iter_get_error(
    const rocksdb_iterator_t*, char** errptr);

/* Write batch */

extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create();
extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create_from(
    const char* rep, size_t size);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_destroy(
    rocksdb_writebatch_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_clear(rocksdb_writebatch_t*);
extern ROCKSDB_LIBRARY_API int rocksdb_writebatch_count(rocksdb_writebatch_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_put(rocksdb_writebatch_t*,
                                                       const char* key,
                                                       size_t klen,
                                                       const char* val,
                                                       size_t vlen);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_put_cf(
    rocksdb_writebatch_t*, rocksdb_column_family_handle_t* column_family,
    const char* key, size_t klen, const char* val, size_t vlen);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_putv(
    rocksdb_writebatch_t* b, int num_keys, const char* const* keys_list,
    const size_t* keys_list_sizes, int num_values,
    const char* const* values_list, const size_t* values_list_sizes);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_putv_cf(
    rocksdb_writebatch_t* b, rocksdb_column_family_handle_t* column_family,
    int num_keys, const char* const* keys_list, const size_t* keys_list_sizes,
    int num_values, const char* const* values_list,
    const size_t* values_list_sizes);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_merge(rocksdb_writebatch_t*,
                                                         const char* key,
                                                         size_t klen,
                                                         const char* val,
                                                         size_t vlen);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_merge_cf(
    rocksdb_writebatch_t*, rocksdb_column_family_handle_t* column_family,
    const char* key, size_t klen, const char* val, size_t vlen);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_mergev(
    rocksdb_writebatch_t* b, int num_keys, const char* const* keys_list,
    const size_t* keys_list_sizes, int num_values,
    const char* const* values_list, const size_t* values_list_sizes);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_mergev_cf(
    rocksdb_writebatch_t* b, rocksdb_column_family_handle_t* column_family,
    int num_keys, const char* const* keys_list, const size_t* keys_list_sizes,
    int num_values, const char* const* values_list,
    const size_t* values_list_sizes);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_delete(rocksdb_writebatch_t*,
                                                          const char* key,
                                                          size_t klen);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_delete_cf(
    rocksdb_writebatch_t*, rocksdb_column_family_handle_t* column_family,
    const char* key, size_t klen);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev(
    rocksdb_writebatch_t* b, int num_keys, const char* const* keys_list,
    const size_t* keys_list_sizes);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev_cf(
    rocksdb_writebatch_t* b, rocksdb_column_family_handle_t* column_family,
    int num_keys, const char* const* keys_list, const size_t* keys_list_sizes);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_put_log_data(
    rocksdb_writebatch_t*, const char* blob, size_t len);
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate(
    rocksdb_writebatch_t*, void* state,
    void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen),
    void (*deleted)(void*, const char* k, size_t klen));
extern ROCKSDB_LIBRARY_API const char* rocksdb_writebatch_data(
    rocksdb_writebatch_t*, size_t* size);

/* Block based table options */

extern ROCKSDB_LIBRARY_API rocksdb_block_based_table_options_t*
rocksdb_block_based_options_create();
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_destroy(
    rocksdb_block_based_table_options_t* options);
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_block_size(
    rocksdb_block_based_table_options_t* options, size_t block_size);
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_block_size_deviation(
    rocksdb_block_based_table_options_t* options, int block_size_deviation);
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_block_restart_interval(
    rocksdb_block_based_table_options_t* options, int block_restart_interval);
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_filter_policy(
    rocksdb_block_based_table_options_t* options,
    rocksdb_filterpolicy_t* filter_policy);
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_no_block_cache(
    rocksdb_block_based_table_options_t* options, unsigned char no_block_cache);
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_block_cache(
    rocksdb_block_based_table_options_t* options, rocksdb_cache_t* block_cache);
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_block_cache_compressed(
    rocksdb_block_based_table_options_t* options,
    rocksdb_cache_t* block_cache_compressed);
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_whole_key_filtering(
    rocksdb_block_based_table_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_format_version(
    rocksdb_block_based_table_options_t*, int);
enum {
  rocksdb_block_based_table_index_type_binary_search = 0,
  rocksdb_block_based_table_index_type_hash_search = 1,
};
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_index_type(
    rocksdb_block_based_table_options_t*, int);  // uses one of the above enums
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_hash_index_allow_collision(
    rocksdb_block_based_table_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_cache_index_and_filter_blocks(
    rocksdb_block_based_table_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache(
    rocksdb_block_based_table_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void
rocksdb_block_based_options_set_skip_table_builder_flush(
    rocksdb_block_based_table_options_t* options, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_block_based_table_factory(
    rocksdb_options_t* opt, rocksdb_block_based_table_options_t* table_options);

/* Cuckoo table options */

extern ROCKSDB_LIBRARY_API rocksdb_cuckoo_table_options_t*
rocksdb_cuckoo_options_create();
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_destroy(
    rocksdb_cuckoo_table_options_t* options);
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_hash_ratio(
    rocksdb_cuckoo_table_options_t* options, double v);
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_max_search_depth(
    rocksdb_cuckoo_table_options_t* options, uint32_t v);
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_cuckoo_block_size(
    rocksdb_cuckoo_table_options_t* options, uint32_t v);
extern ROCKSDB_LIBRARY_API void
rocksdb_cuckoo_options_set_identity_as_first_hash(
    rocksdb_cuckoo_table_options_t* options, unsigned char v);
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_use_module_hash(
    rocksdb_cuckoo_table_options_t* options, unsigned char v);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_cuckoo_table_factory(
    rocksdb_options_t* opt, rocksdb_cuckoo_table_options_t* table_options);

/* Options */

extern ROCKSDB_LIBRARY_API rocksdb_options_t* rocksdb_options_create();
extern ROCKSDB_LIBRARY_API void rocksdb_options_destroy(rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_increase_parallelism(
    rocksdb_options_t* opt, int total_threads);
extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_for_point_lookup(
    rocksdb_options_t* opt, uint64_t block_cache_size_mb);
extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_level_style_compaction(
    rocksdb_options_t* opt, uint64_t memtable_memory_budget);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_optimize_universal_style_compaction(
    rocksdb_options_t* opt, uint64_t memtable_memory_budget);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_filter(
    rocksdb_options_t*, rocksdb_compactionfilter_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_filter_factory(
    rocksdb_options_t*, rocksdb_compactionfilterfactory_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_compaction_readahead_size(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_comparator(
    rocksdb_options_t*, rocksdb_comparator_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_merge_operator(
    rocksdb_options_t*, rocksdb_mergeoperator_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_uint64add_merge_operator(
    rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compression_per_level(
    rocksdb_options_t* opt, int* level_values, size_t num_levels);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_create_if_missing(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_create_missing_column_families(rocksdb_options_t*,
                                                   unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_error_if_exists(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_paranoid_checks(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_env(rocksdb_options_t*,
                                                        rocksdb_env_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_info_log(rocksdb_options_t*,
                                                             rocksdb_logger_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_info_log_level(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_buffer_size(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_db_write_buffer_size(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_open_files(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_total_wal_size(
    rocksdb_options_t* opt, uint64_t n);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compression_options(
    rocksdb_options_t*, int, int, int, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_prefix_extractor(
    rocksdb_options_t*, rocksdb_slicetransform_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_num_levels(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_level0_file_num_compaction_trigger(rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_level0_slowdown_writes_trigger(rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_level0_stop_writes_trigger(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_mem_compaction_level(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_target_file_size_base(
    rocksdb_options_t*, uint64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_target_file_size_multiplier(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_bytes_for_level_base(
    rocksdb_options_t*, uint64_t);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_max_bytes_for_level_multiplier(rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_max_bytes_for_level_multiplier_additional(
    rocksdb_options_t*, int* level_values, size_t num_levels);
extern ROCKSDB_LIBRARY_API void rocksdb_options_enable_statistics(
    rocksdb_options_t*);

/* returns a pointer to a malloc()-ed, null terminated string */
extern ROCKSDB_LIBRARY_API char* rocksdb_options_statistics_get_string(
    rocksdb_options_t* opt);

extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_write_buffer_number(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_min_write_buffer_number_to_merge(rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_max_write_buffer_number_to_maintain(rocksdb_options_t*,
                                                        int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_compactions(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_flushes(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_log_file_size(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_log_file_time_to_roll(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_keep_log_file_num(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_recycle_log_file_num(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_soft_rate_limit(
    rocksdb_options_t*, double);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hard_rate_limit(
    rocksdb_options_t*, double);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_rate_limit_delay_max_milliseconds(rocksdb_options_t*,
                                                      unsigned int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_manifest_file_size(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_table_cache_numshardbits(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_table_cache_remove_scan_count_limit(rocksdb_options_t*,
                                                        int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_arena_block_size(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_use_fsync(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_db_log_dir(
    rocksdb_options_t*, const char*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_wal_dir(rocksdb_options_t*,
                                                            const char*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_WAL_ttl_seconds(
    rocksdb_options_t*, uint64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_WAL_size_limit_MB(
    rocksdb_options_t*, uint64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_manifest_preallocation_size(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_purge_redundant_kvs_while_flush(rocksdb_options_t*,
                                                    unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_allow_os_buffer(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_allow_mmap_reads(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_allow_mmap_writes(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_is_fd_close_on_exec(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_skip_log_error_on_recovery(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_stats_dump_period_sec(
    rocksdb_options_t*, unsigned int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_advise_random_on_open(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_access_hint_on_compaction_start(rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_use_adaptive_mutex(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_bytes_per_sync(
    rocksdb_options_t*, uint64_t);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_verify_checksums_in_compaction(rocksdb_options_t*,
                                                   unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_filter_deletes(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_max_sequential_skip_in_iterations(rocksdb_options_t*,
                                                      uint64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_data_sync(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_auto_compactions(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_delete_obsolete_files_period_micros(rocksdb_options_t*,
                                                        uint64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_prepare_for_bulk_load(
    rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_memtable_vector_rep(
    rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_compaction_bytes(
    rocksdb_options_t*, uint64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hash_skip_list_rep(
    rocksdb_options_t*, size_t, int32_t, int32_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hash_link_list_rep(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_plain_table_factory(
    rocksdb_options_t*, uint32_t, int, double, size_t);

extern ROCKSDB_LIBRARY_API void rocksdb_options_set_min_level_to_compress(
    rocksdb_options_t* opt, int level);

extern ROCKSDB_LIBRARY_API void rocksdb_options_set_memtable_prefix_bloom_bits(
    rocksdb_options_t*, uint32_t);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_memtable_prefix_bloom_probes(rocksdb_options_t*, uint32_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_memtable_huge_page_size(
    rocksdb_options_t*, size_t);

extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_successive_merges(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_min_partial_merge_operands(
    rocksdb_options_t*, uint32_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_bloom_locality(
    rocksdb_options_t*, uint32_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_inplace_update_support(
    rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_inplace_update_num_locks(
    rocksdb_options_t*, size_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_report_bg_io_stats(
    rocksdb_options_t*, int);

enum {
  rocksdb_tolerate_corrupted_tail_records_recovery = 0,
  rocksdb_absolute_consistency_recovery = 1,
  rocksdb_point_in_time_recovery = 2,
  rocksdb_skip_any_corrupted_records_recovery = 3
};
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_wal_recovery_mode(
    rocksdb_options_t*, int);

enum {
  rocksdb_no_compression = 0,
  rocksdb_snappy_compression = 1,
  rocksdb_zlib_compression = 2,
  rocksdb_bz2_compression = 3,
  rocksdb_lz4_compression = 4,
  rocksdb_lz4hc_compression = 5
};
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compression(
    rocksdb_options_t*, int);

enum {
  rocksdb_level_compaction = 0,
  rocksdb_universal_compaction = 1,
  rocksdb_fifo_compaction = 2
};
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_style(
    rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_universal_compaction_options(
    rocksdb_options_t*, rocksdb_universal_compaction_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_fifo_compaction_options(
    rocksdb_options_t* opt, rocksdb_fifo_compaction_options_t* fifo);

/* Compaction Filter */

extern ROCKSDB_LIBRARY_API rocksdb_compactionfilter_t*
rocksdb_compactionfilter_create(
    void* state, void (*destructor)(void*),
    unsigned char (*filter)(void*, int level, const char* key,
                            size_t key_length, const char* existing_value,
                            size_t value_length, char** new_value,
                            size_t* new_value_length,
                            unsigned char* value_changed),
    const char* (*name)(void*));
extern ROCKSDB_LIBRARY_API void rocksdb_compactionfilter_set_ignore_snapshots(
    rocksdb_compactionfilter_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_compactionfilter_destroy(
    rocksdb_compactionfilter_t*);

/* Compaction Filter Context */

extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_compactionfiltercontext_is_full_compaction(
    rocksdb_compactionfiltercontext_t* context);

extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_compactionfiltercontext_is_manual_compaction(
    rocksdb_compactionfiltercontext_t* context);

/* Compaction Filter Factory */

extern ROCKSDB_LIBRARY_API rocksdb_compactionfilterfactory_t*
rocksdb_compactionfilterfactory_create(
    void* state, void (*destructor)(void*),
    rocksdb_compactionfilter_t* (*create_compaction_filter)(
        void*, rocksdb_compactionfiltercontext_t* context),
    const char* (*name)(void*));
extern ROCKSDB_LIBRARY_API void rocksdb_compactionfilterfactory_destroy(
    rocksdb_compactionfilterfactory_t*);

/* Comparator */

extern ROCKSDB_LIBRARY_API rocksdb_comparator_t* rocksdb_comparator_create(
    void* state, void (*destructor)(void*),
    int (*compare)(void*, const char* a, size_t alen, const char* b,
                   size_t blen),
    const char* (*name)(void*));
extern ROCKSDB_LIBRARY_API void rocksdb_comparator_destroy(
    rocksdb_comparator_t*);

/* Filter policy */

extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t* rocksdb_filterpolicy_create(
    void* state, void (*destructor)(void*),
    char* (*create_filter)(void*, const char* const* key_array,
                           const size_t* key_length_array, int num_keys,
                           size_t* filter_length),
    unsigned char (*key_may_match)(void*, const char* key, size_t length,
                                   const char* filter, size_t filter_length),
    void (*delete_filter)(void*, const char* filter, size_t filter_length),
    const char* (*name)(void*));
extern ROCKSDB_LIBRARY_API void rocksdb_filterpolicy_destroy(
    rocksdb_filterpolicy_t*);

extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t*
rocksdb_filterpolicy_create_bloom(int bits_per_key);
extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t*
rocksdb_filterpolicy_create_bloom_full(int bits_per_key);

/* Merge Operator */

extern ROCKSDB_LIBRARY_API rocksdb_mergeoperator_t*
rocksdb_mergeoperator_create(
    void* state, void (*destructor)(void*),
    char* (*full_merge)(void*, const char* key, size_t key_length,
                        const char* existing_value,
                        size_t existing_value_length,
                        const char* const* operands_list,
                        const size_t* operands_list_length, int num_operands,
                        unsigned char* success, size_t* new_value_length),
    char* (*partial_merge)(void*, const char* key, size_t key_length,
                           const char* const* operands_list,
                           const size_t* operands_list_length, int num_operands,
                           unsigned char* success, size_t* new_value_length),
    void (*delete_value)(void*, const char* value, size_t value_length),
    const char* (*name)(void*));
extern ROCKSDB_LIBRARY_API void rocksdb_mergeoperator_destroy(
    rocksdb_mergeoperator_t*);

/* Read options */

extern ROCKSDB_LIBRARY_API rocksdb_readoptions_t* rocksdb_readoptions_create();
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_destroy(
    rocksdb_readoptions_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_verify_checksums(
    rocksdb_readoptions_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_fill_cache(
    rocksdb_readoptions_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_snapshot(
    rocksdb_readoptions_t*, const rocksdb_snapshot_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_iterate_upper_bound(
    rocksdb_readoptions_t*, const char* key, size_t keylen);
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_read_tier(
    rocksdb_readoptions_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_tailing(
    rocksdb_readoptions_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_readahead_size(
    rocksdb_readoptions_t*, size_t);

/* Write options */

extern ROCKSDB_LIBRARY_API rocksdb_writeoptions_t*
rocksdb_writeoptions_create();
extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_destroy(
    rocksdb_writeoptions_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_set_sync(
    rocksdb_writeoptions_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_disable_WAL(
    rocksdb_writeoptions_t* opt, int disable);

/* Flush options */

extern ROCKSDB_LIBRARY_API rocksdb_flushoptions_t*
rocksdb_flushoptions_create();
extern ROCKSDB_LIBRARY_API void rocksdb_flushoptions_destroy(
    rocksdb_flushoptions_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_flushoptions_set_wait(
    rocksdb_flushoptions_t*, unsigned char);

/* Cache */

extern ROCKSDB_LIBRARY_API rocksdb_cache_t* rocksdb_cache_create_lru(
    size_t capacity);
extern ROCKSDB_LIBRARY_API void rocksdb_cache_destroy(rocksdb_cache_t* cache);
extern ROCKSDB_LIBRARY_API void rocksdb_cache_set_capacity(
    rocksdb_cache_t* cache, size_t capacity);

/* Env */

extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_default_env();
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_mem_env();
extern ROCKSDB_LIBRARY_API void rocksdb_env_set_background_threads(
    rocksdb_env_t* env, int n);
extern ROCKSDB_LIBRARY_API void
rocksdb_env_set_high_priority_background_threads(rocksdb_env_t* env, int n);
extern ROCKSDB_LIBRARY_API void rocksdb_env_join_all_threads(
    rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void rocksdb_env_destroy(rocksdb_env_t*);

/* SliceTransform */

extern ROCKSDB_LIBRARY_API rocksdb_slicetransform_t*
rocksdb_slicetransform_create(
    void* state, void (*destructor)(void*),
    char* (*transform)(void*, const char* key, size_t length,
                       size_t* dst_length),
    unsigned char (*in_domain)(void*, const char* key, size_t length),
    unsigned char (*in_range)(void*, const char* key, size_t length),
    const char* (*name)(void*));
extern ROCKSDB_LIBRARY_API rocksdb_slicetransform_t*
    rocksdb_slicetransform_create_fixed_prefix(size_t);
extern ROCKSDB_LIBRARY_API rocksdb_slicetransform_t*
rocksdb_slicetransform_create_noop();
extern ROCKSDB_LIBRARY_API void rocksdb_slicetransform_destroy(
    rocksdb_slicetransform_t*);

/* Universal Compaction options */

enum {
  rocksdb_similar_size_compaction_stop_style = 0,
  rocksdb_total_size_compaction_stop_style = 1
};

extern ROCKSDB_LIBRARY_API rocksdb_universal_compaction_options_t*
rocksdb_universal_compaction_options_create();
extern ROCKSDB_LIBRARY_API void
rocksdb_universal_compaction_options_set_size_ratio(
    rocksdb_universal_compaction_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_universal_compaction_options_set_min_merge_width(
    rocksdb_universal_compaction_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_universal_compaction_options_set_max_merge_width(
    rocksdb_universal_compaction_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_universal_compaction_options_set_max_size_amplification_percent(
    rocksdb_universal_compaction_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_universal_compaction_options_set_compression_size_percent(
    rocksdb_universal_compaction_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_universal_compaction_options_set_stop_style(
    rocksdb_universal_compaction_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_universal_compaction_options_destroy(
    rocksdb_universal_compaction_options_t*);

extern ROCKSDB_LIBRARY_API rocksdb_fifo_compaction_options_t*
rocksdb_fifo_compaction_options_create();
extern ROCKSDB_LIBRARY_API void
rocksdb_fifo_compaction_options_set_max_table_files_size(
    rocksdb_fifo_compaction_options_t* fifo_opts, uint64_t size);
extern ROCKSDB_LIBRARY_API void rocksdb_fifo_compaction_options_destroy(
    rocksdb_fifo_compaction_options_t* fifo_opts);

extern ROCKSDB_LIBRARY_API int rocksdb_livefiles_count(
    const rocksdb_livefiles_t*);
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_name(
    const rocksdb_livefiles_t*, int index);
extern ROCKSDB_LIBRARY_API int rocksdb_livefiles_level(
    const rocksdb_livefiles_t*, int index);
extern ROCKSDB_LIBRARY_API size_t
rocksdb_livefiles_size(const rocksdb_livefiles_t*, int index);
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_smallestkey(
    const rocksdb_livefiles_t*, int index, size_t* size);
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_largestkey(
    const rocksdb_livefiles_t*, int index, size_t* size);
extern ROCKSDB_LIBRARY_API void rocksdb_livefiles_destroy(
    const rocksdb_livefiles_t*);

/* Utility Helpers */

extern ROCKSDB_LIBRARY_API void rocksdb_get_options_from_string(
    const rocksdb_options_t* base_options, const char* opts_str,
    rocksdb_options_t* new_options, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_delete_file_in_range(
    rocksdb_t* db, const char* start_key, size_t start_key_len,
    const char* limit_key, size_t limit_key_len, char** errptr);

extern ROCKSDB_LIBRARY_API void rocksdb_delete_file_in_range_cf(
    rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
    const char* start_key, size_t start_key_len, const char* limit_key,
    size_t limit_key_len, char** errptr);

// referring to convention (3), this should be used by client
// to free memory that was malloc()ed
extern ROCKSDB_LIBRARY_API void rocksdb_free(void* ptr);

#ifdef __cplusplus
}  /* end extern "C" */
#endif

#endif  /* STORAGE_ROCKSDB_INCLUDE_C_H_ */


text:
#include<Arduino.h>
class SRButtons{
  private:
    byte srClockPin;
    byte srDataPin;
    byte btnInputPin;

    static const byte dbncDelay = 20; //ms
    bool isPressedNow=false;
    long pressedSince=0;//ms

    bool highIsOn;

  public:
    SRButtons(byte srClockPin, byte srDataPin, byte btnInputPin,bool highIsOn);
    bool isPressed(byte btn);
};


text:
'use strict';

var extend = require('../utils/extend');
var IonicAppLib = require('ionic-app-lib');
var IonicResources = IonicAppLib.resources;
var appLibUtils = IonicAppLib.utils;
var Project = IonicAppLib.project;

var resourcesSummary = [
  'Automatically create icon and splash screen resources' + ' (beta)'.yellow,
  'Put your images in the ./resources directory, named splash or icon.',
  'Accepted file types are .png, .ai, and .psd.',
  'Icons should be 192x192 px without rounded corners.',
  'Splashscreens should be 2208x2208 px, with the image centered in the middle.\n'
].join('\n\t\t      ');

var settings = {
  title: 'resources',
  name: 'resources',
  summary: resourcesSummary,
  options: {
    '--icon|-i': {
      title: 'Generate icon resources',
      boolean: true
    },
    '--splash|-s': {
      title: 'Generate splash screen resources',
      boolean: true
    }
  },
  isProjectTask: true
};

function run(ionic, argv) {
  var dir = null;

  try {
    dir = process.cwd();
    Project.load(dir);
  } catch (ex) {
    return appLibUtils.fail(ex, 'resources');
  }

  var options = argv;
  options.platforms = argv._;

  return IonicResources.generate(dir, options)
    .catch(function(ex) {
      if (ex instanceof Error) {
        appLibUtils.fail(ex, 'resources');
      }
    });
}

module.exports = extend(settings, {
  run: run
});


text:
/*
 * Launch and expose app
 */

module.exports = function (target) {

  var express = require('express')
  , fs = require('fs')
  , mongoose  = require('mongoose')
  , passport  = require('passport');

  /* Load config */

  var env = process.env.NODE_ENV || 'development'
    , config = require('./config/config')[env];

  config.gruntTarget = target;

  /* Mongoose config */

  function connect() {
    var options = { server: { socketOptions: { keepAlive: 1, auto_reconnect: true } } };
    mongoose.connect(config.db, options);
  }
  connect();

  // Error handler
  mongoose.connection.on('error', function (err) {
    console.log('Mongoose Connection Error: ' + err);
  });

  // Reconnect when closed
  mongoose.connection.on('disconnected', function () {
    connect();
  });

  /* Models */

  var models_path = __dirname + '/models';
  fs.readdirSync(models_path).forEach(function (file) {
    if (~file.indexOf('.js')) require(models_path + '/' + file);
  });

  /* Load fixture data */

  // mongoose.connection.once('open', function() {
  //   require('./config/fixtures.js');
  // });

  /* Passport config */

  require('./config/passport')(passport, config);

  /* Express config */

  var app = express();
  require('./config/express')(app, config, passport);

  /* Routes */

  require('./config/routes')(app, passport);

  /* Launch server */

  var port = process.env.PORT || 3000;
  app.listen(port);
  console.log('Express app started on port '+port);

  return app;
}


text:
namespace UltimateTeam.Toolkit.Models
{
    public class ListAuctionResponse
    {
        public long Id { get; set; }
    }
}


text:
'use strict';

import chai = require('chai');
var assert = chai.assert;

import helper = require('../../test/helper');
import typeOf = require('../../xm/typeOf');

describe('typeOf', () => {

	var func = function () {
		// dummy
	};

	var data = (function () {
		return {
			arguments: [typeOf.isArguments, arguments],
			array: [typeOf.isArray, []],
			date: [typeOf.isDate, new Date()],
			function: [typeOf.isFunction, func],
			number: [typeOf.isNumber, 123],
			regexp: [typeOf.isRegExp, /abc/],
			string: [typeOf.isString, 'abc'],
			null: [typeOf.isNull, null],
			undefined: [typeOf.isUndefined, undefined],
			object: [typeOf.isObject, {}],
			boolean: [typeOf.isBoolean, true]
		};
	})();

	describe('typeOf.get()', () => {
		for (var mainType in data) {
			if (data.hasOwnProperty(mainType)) {

				it(mainType, () => {
					for (var checkType in data) {
						if (data.hasOwnProperty(checkType)) {
							var checkData = data[checkType];
							if (checkType === mainType) {
								assert.strictEqual(typeOf.get(checkData[1]), mainType);
							}
							else {
								assert.notStrictEqual(typeOf.get(checkData[1]), mainType);
							}
						}
					}
				});
			}
		}
	});

	describe('is<type>()', () => {
		for (var mainType in data) {
			if (data.hasOwnProperty(mainType)) {
				var mainData = data[mainType];

				it(mainType, () => {
					var func = mainData[0];
					for (var checkType in data) {
						if (data.hasOwnProperty(checkType)) {
							var checkData = data[checkType];
							if (checkType === mainType) {
								assert.isTrue(func(checkData[1]), 'testing ' + checkType);
							}
							else {
								assert.isFalse(func(checkData[1]), 'testing ' + checkType);
							}
						}
					}
				});
			}
		}
	});

	describe('isType() by name', () => {
		for (var mainType in data) {
			if (data.hasOwnProperty(mainType)) {

				it(mainType, () => {
					for (var checkType in data) {
						if (data.hasOwnProperty(checkType)) {
							var checkData = data[checkType];
							if (checkType === mainType) {
								assert.isTrue(typeOf.isType(checkData[1], mainType), 'testing ' + checkType);
							}
							else {
								assert.isFalse(typeOf.isType(checkData[1], mainType), 'testing ' + checkType);
							}
						}
					}
				});
			}
		}
	});

	describe('isValid() by name', () => {
		it('isValid', () => {
			assert.isTrue(typeOf.isValid(1), 'number');
			assert.isTrue(typeOf.isValid(true), 'boolean');
			assert.isTrue(typeOf.isValid({}), 'object');
			assert.isTrue(typeOf.isValid(0), '0');
			assert.isTrue(typeOf.isValid(false), 'false');
		});

		it('not isValid', () => {
			assert.isFalse(typeOf.isValid(undefined), 'undefined');
			assert.isFalse(typeOf.isValid(null), 'null');
			assert.isFalse(typeOf.isValid(parseFloat('nope')), 'parseFloat: NaN');
		});
	});
});


text:
int controls()
{
	memset(&pad, 0, sizeof(SceCtrlData));
	sceCtrlPeekBufferPositive(0, &pad, 1);

	pressed = pad.buttons & ~old_pad.buttons;

	old_pad = pad;
	return 0;
}

void setBilinearFilter(int enabled, vita2d_texture * texture)
{
	if (enabled == 1)
		vita2d_texture_set_filters(texture, SCE_GXM_TEXTURE_FILTER_LINEAR, SCE_GXM_TEXTURE_FILTER_LINEAR);
}

vita2d_texture * loadPngWithFilter(const void *buffer)
{
	vita2d_texture *texture = vita2d_load_PNG_buffer(buffer);
	setBilinearFilter(1, texture);

	return texture;
}

void endDrawing()
{
	vita2d_end_drawing();
	vita2d_common_dialog_update();
	vita2d_swap_buffers();
	sceDisplayWaitVblankStart();
}